Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is pass by reference in functions?

835


what is the function of pragma directive in c?

1114


What are variables c?

1043


What are valid signatures for the Main function?

1218


What is a memory leak? How to avoid it?

1328


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?

2533


Write a program to know whether the input number is an armstrong number.

1108


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

1086


What is #define used for in c?

1056


Why we use break in c?

996


Is it cc or c in a letter?

1013


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.

1089


Is c still relevant?

1074


What is sizeof array?

1050


difference between object file and executable file

6708