Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
 Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE

 Categories >> Code Snippets >> Programming Code >> C Code

 C Code Interview Questions (400) C++ Code Interview Questions (121) VC++ Code Interview Questions (2) Java Code Interview Questions (57) Dot Net Code Interview Questions (113) Visual Basic Code Interview Questions (8) Programming Code AllOther Interview Questions (37)
Question
```# include<stdio.h>

aaa() {

printf("hi");

}

bbb(){

printf("hello");

}

ccc(){

printf("bye");

}

main()

{

int (*ptr[3])();

ptr[0]=aaa;

ptr[1]=bbb;

ptr[2]=ccc;

ptr[2]();

}```
Question Submitted By :: Susie
I also faced this Question!!     Rank Answer Posted By

Re: # include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }
# 1

bye

Explanation:

ptr is array of pointers to functions of return type
int.ptr[0] is assigned to address of the function aaa.
Similarly ptr[1] and ptr[2] for bbb and ccc respectively.
ptr[2]() is in effect of writing ccc(), since ptr[2] points
to ccc.

 Is This Answer Correct ? 1 Yes 0 No
Susie

  Question Asked @ Answers Other C Code Interview Questions How to palindrom string in c language? Google 6 Is the following statement a declaration/definition. Find what does it mean? int (*x)[10]; 1 void main() { int c; c=printf("Hello world"); printf("\n%d",c); } 2 main() { unsigned int i=65000; while(i++!=0); printf("%d",i); } 1 How can i find first 5 natural Numbers without using any loop in c language???????? Microsoft 2 #define f(g,g2) g##g2 main() { int var12=100; printf("%d",f(var,12)); } 3 main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024 HCL 2 program to Reverse a linked list Ness-Technologies 12 Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program. Wipro 3 main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); } 1 int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); } 1 main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\n", 1L << i); } } a. 5, 4, 3, 2, 1 b. 0, 1, 2, 3, 4 c. 0, 1, 2, 4, 8 d. 1, 2, 4, 8, 16 HCL 4 For more C Code Interview Questions Click Here