Why the function pointer pointing to different function works than it is
defined
In the following program the function pointer is defined to point to a
function which accepts no argument and returns void yet the function
pointer works here. Why?
#include<stdio.h>
int mul(int*,int*);
void main()
{ int a=10,b=20;
int(*p)();
p=&mul;
printf("%d ", (*p)(&a,&b));
}
int mul(int*a,int*b)
{
return (*a * *b);
}
No comments:
Post a Comment