Home > C Programming > Functions > Questions and Answers
01. |
What will the code below print when it is executed? #include void func() { int x = 0; static int y = 0; x++; y++; printf( "%d -- %d\n", x, y ); } int main() { func(); func(); return 0; } | |||||||||||
|
02. |
What is the output of the following code? #include void main() { int s=0; while(s++<10)> # define a 10 main() { printf("%d..",a); foo(); printf("%d",a); } void foo() { #undef a #define a 50 } | |||||||||||
|
03. |
What is the output of the following code? main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); } | |||||||||||
|
04. |
What is the output of the following code? main() { show(); } void show() { printf("I'm the greatest"); } | |||||||||||
|
05. |
What is the output of the following code? main() { int i; i = abc(); printf("%d",i); } abc() { _AX = 1000; } | |||||||||||
|
06. |
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*/ } | |||||||||||
|
07. |
What is the output of the following code? 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); } | |||||||||||
|
08. |
What is the output of the following code? void ( * abc( int, void ( *def) () ) ) (); | |||||||||||
|
09. | Which is not a proper prototype? | |||||||||||
|
10. | What is the return type of the function with prototype: "int func(char x, float v, double t);" | |||||||||||
|