struct timeval measureMultiplyMatrices(Matrix* m1, Matrix* m2, Matrix** result, Matrix* (*functionPtr)(Matrix*, Matrix*)) { struct timeval t1, t2, diff; gettimeofday(&t1, NULL); (*result) = functionPtr(m1, m2); gettimeofday(&t2, NULL); timeval_subtract(&diff, &t2, &t1); return diff; }
struct timeval measureBalanceWork(Matrix* m1, Matrix* m2, int numTasks, Matrix** result, Matrix* (*functionPtr)(Matrix*, Matrix*, int)) { struct timeval t1, t2, diff; gettimeofday(&t1, NULL); (*result) = functionPtr(m1, m2, numTasks); gettimeofday(&t2, NULL); timeval_subtract(&diff, &t2, &t1); return diff; }
int main(void) { greet_a(5); greet_b(10); puts("lol"); functionPtr = addInt; int sum = functionPtr(2, 3); // sum == 5 printf("---> %d \n", sum); Greeter g = new_Greeter(); g->SayHi(); g->SayHiTo(100); return EXIT_SUCCESS; }