what is a function pointer and how all to declare ,define
and implement it ???
Answer Posted / satish
Function pointer:
a function can be called not only by
its name,but also by other name which is called function
pointer.
void fact(int);
void main()
{
void(*p)(int);
printf("Enter n\n");
scanf("%d",&n);
p=fact;
fact(n);/*normal calling a function*/
(*p)(n); /*fn calling using function pointer*/
}
void (*p)(int n)
{
int ans=1;
while(n>0)
{
ans*=n--;
}
printf(" %d != %d",n,ans);
Is This Answer Correct ? | 3 Yes | 4 No |
Post New Answer View All Answers
When should you not use a type cast?
Why is %d used in c?
What is volatile c?
What are logical errors and how does it differ from syntax errors?
What is queue in c?
Is sizeof a keyword in c?
I have seen function declarations that look like this
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
Are there any problems with performing mathematical operations on different variable types?
What are near, far and huge pointers?
Explain how can you be sure that a program follows the ansi c standard?
Explain about the constants which help in debugging?
What is ## preprocessor operator in c?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
Who is the founder of c language?