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
If fflush wont work, what can I use to flush input?
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
what is the different bitween abap and abap-hr?
What is character constants?
Why doesnt this code work?
What is exit() function?
Do variables need to be initialized?
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
How to write a multi-statement macro?
Why we use void main in c?
What is typeof in c?
What are local static variables?
Explain how can I prevent another program from modifying part of a file that I am modifying?
Tell me when would you use a pointer to a function?
What is default value of global variable in c?