main()

{

int (*functable[2])(char *format, ...) ={printf, scanf};

int i = 100;

(*functable[0])("%d", i);

(*functable[1])("%d", i);

(*functable[1])("%d", i);

(*functable[0])("%d", &i);

}

a. 100, Runtime error.

b. 100, Random number, Random number, Random number.

c. Compile error

d. 100, Random number



main() { int (*functable[2])(char *format, ...) ={printf, scanf}; int i = 100; ..

Answer / vishnu kant gupta

a is correct.

because it should be -

(*functable[0])("%d", i);

(*functable[1])("%d", &i);

(*functable[1])("%d", &i);

(*functable[0])("%d", i);

Is This Answer Correct ?    29 Yes 6 No

Post New Answer

More C Code Interview Questions

main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }

1 Answers  


main() { char *p; p="%d\n"; p++; p++; printf(p-2,300); }

1 Answers  


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

9 Answers   Microsoft,


struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }

1 Answers  


main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }

1 Answers  


What are the following notations of defining functions known as? i. int abc(int a,float b) { /* some code */ } ii. int abc(a,b) int a; float b; { /* some code*/ }

1 Answers  


In the following pgm add a stmt in the function fun such that the address of 'a' gets stored in 'j'. main(){ int * j; void fun(int **); fun(&j); } void fun(int **k) { int a =0; /* add a stmt here*/ }

1 Answers  


const int perplexed = 2; #define perplexed 3 main() { #ifdef perplexed #undef perplexed #define perplexed 4 #endif printf("%d",perplexed); } a. 0 b. 2 c. 4 d. none of the above

1 Answers   emc2, HCL,


{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

4 Answers  


write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?

1 Answers  


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

1 Answers  


Categories