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 the significance of scope resolution operator?
What are dangling pointers in c?
Can a program have two main functions?
List the different types of c tokens?
Is there a way to compare two structure variables?
Why does notstrcat(string, "!");Work?
Which built-in library function can be used to match a patter from the string?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
Multiply an Integer Number by 2 Without Using Multiplication Operator
What should malloc() do?
Explain the red-black trees?
What header files do I need in order to define the standard library functions I use?
Explain modulus operator. What are the restrictions of a modulus operator?
What does static variable mean in c?
How does selection sort work in c?