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

void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }

1 Answers  


main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }

1 Answers  


int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }

3 Answers   Cisco, HCL,


void main() { char far *farther,*farthest; printf("%d..%d",sizeof(farther),sizeof(farthest)); }

2 Answers  


#include<stdio.h> #include<conio.h> void main() { int a=(1,2,3,(1,2,3,4); switch(a) { printf("ans:"); case 1: printf("1");break; case 2: printf("2");break; case 3: printf("1");break; case 4: printf("4");break; printf("end"); } getch(); }

0 Answers  






# 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 Answers  


Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.

2 Answers   Mentor Graphics, Microsoft,


how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.

19 Answers   Cap Gemini, Infosys,


void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }

4 Answers  


What is your nationality?

1 Answers   GoDB Tech,


Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?

0 Answers  


How we print the table of 2 using for loop in c programing?

14 Answers   HCL, Wipro,


Categories