/* illustrates how to determine no. of times each routine is called during the program execution (profile): cc -p -o bprofile bprofile.c bqksort.c bprofile -- this will create mon.out (monitored info file) prof bprofile -- will print the profile info using mon.out */ #include #define N 50000 main() { int a[N], i; void quicksort(int *, int *); /* head, tail pointers on the array */ srand(time(NULL)); /* generates a seed value from the current time */ for (i = 0; i < N; ++i) a[i] = rand() % 10000; quicksort(a, a + N - 1); for (i = 0; i < N - 1; ++i) if (a[i] > a[i + 1]) { printf("Sorting error - bye!\n"); exit(1); } }