#include <stdio.h>
void test() { printf("t%d\n", __LINE__); }
void test1() { printf("t1%d\n", __LINE__); }
int Callback_1(int x) // Callback Function 1
{
printf("Hello, this is Callback_1: x = %d ", x);
return 0;
}
int Callback_2(int x) // Callback Function 2
{
printf("Hello, this is Callback_2: x = %d ", x);
return 0;
}
int Handle2(int y, int (*Callback)(int)) {
printf("Entering ---Handle2 Function. \n");
Callback(y);
printf("Leaving ---Handle2 Function. \n");
}
int Handle(void (*Callback)()) {
printf("Entering Handle Function. \n");
Callback();
printf("Leaving Handle Function. \n");
}
int main() {
printf("Entering Main Function. ");
Handle(test);
Handle(test1);
int a = 2;
int b = 4;
int c = 6;
printf("Entering Handle2 Function. ");
Handle2(a, Callback_1);
Handle2(b, Callback_2);
printf("Leaving Main Function. ");
return 0;
}