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
Explain what is the difference between functions getch() and getche()?
What is an endless loop?
How do we declare variables in c?
what is a constant pointer in C
which is an algorithm for sorting in a growing Lexicographic order
What is property type c?
What is void main () in c?
Explain what is the benefit of using #define to declare a constant?
Why doesnt that code work?
What is the purpose of & in scanf?
write a program to concatenation the string using switch case?
How can my program discover the complete pathname to the executable from which it was invoked?
What is a nested loop?
What does printf does?
Why clrscr is used in c?