One way is to use time(). Only problem is that it will only give you it in seconds. For anything else it becomes compiler/OS specific.

Code:
unsigned int before, after;
before = time(NULL);
foo();
after = time(NULL);
printf("It took %ld seconds to complete the function\n", after-before);