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
What is pass by reference in functions?
what is the function of pragma directive in c?
What are variables c?
What are valid signatures for the Main function?
What is a memory leak? How to avoid it?
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
Write a program to know whether the input number is an armstrong number.
A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile
What is #define used for in c?
Why we use break in c?
Is it cc or c in a letter?
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
Is c still relevant?
What is sizeof array?
difference between object file and executable file