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

Explain what is the difference between functions getch() and getche()?

1109


What is an endless loop?

1318


How do we declare variables in c?

1113


what is a constant pointer in C

1243


which is an algorithm for sorting in a growing Lexicographic order

1861


What is property type c?

1130


What is void main () in c?

1249


Explain what is the benefit of using #define to declare a constant?

1271


Why doesnt that code work?

1271


What is the purpose of & in scanf?

1120


write a program to concatenation the string using switch case?

2143


How can my program discover the complete pathname to the executable from which it was invoked?

1117


What is a nested loop?

1178


What does printf does?

1315


Why clrscr is used in c?

1057