Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void fun1()
- {
- }
- void fun2()
- {
- }
- void fun3()
- {
- }
- void (*func_ptr[3]) = {fun1, fun2, fun3};
- main()
- {
- int option;
- printf("\nEnter function number you want");
- printf("\nYou should not enter other than 0 , 1, 2"); /* because we have only 3 functions */
- scanf("%d",&option);
- if((option>=0)&&(option<=2))
- {
- (*func_ptr[option])();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement