I came across these two programs:
int* getb(int* p);
void main()
{
int x = 5 ;
int* ptr = getb(&x);
printf("%d\n",*ptr);
}
int* getb(int* p)
{
int* re = (int*)malloc(1*sizeof(int));
*re = *p *= 2;
return re;
}
void fun(int a)
{
printf("Value of a is %d\n", a);
}
int main()
{
void (*fun_ptr)(int) = &fun;
(*fun_ptr)(10);
return 0;
}
What is the difference between the function pointer declarations in the two programs?
int* getb(int* p);
and
void (*fun_ptr)(int) = &fun;