What do you think about the following C Code ? What will be the output.
#include <stdio.h> int main (void) { static int a = 3; if (a == 0) { return 0; } printf ("going down\n"); a--; main (); printf ("coming up\n"); return 0; }
What do you think about the following C Code ? What will be the output.
#include <stdio.h> int main (void) { static int a = 3; if (a == 0) { return 0; } printf ("going down\n"); a--; main (); printf ("coming up\n"); return 0; }
What do you this should be the output of the below code? Is there any problem in the code?
#include <stdio.h> int main(void) { int x = -1, y = 1, a, b, c, d, e, f; a = x << 4; b = x >> 4; c = y << 4; d = y >> 4; e = y << sizeof (int) * 8; f = y << -4; printf("a = %x \nb = %x \nc = %x \nd = %x \ne = %x \nf = %x",a, b, c, d, e, f); printf ("\n"); return 0; }
The below code is given. You need to determine what the output will be, or if there is an error.
#include<stdio.h> int main() { int *j; int *fun(); j = fun(); printf("%d\n",*j); printf("%d",*j); return 0; } int *fun() { int k = 35; return(&k); }
Continue reading “C Q&A #0: Returning address of local variable”