After sometime the stack memory will be filled completely. Hence stack overflow error will occur.
#include<stdio.h> int main() { printf("%x\n", -1<<3); return 0; }
#include<stdio.h> #include<string.h> int main() { printf("%c\n", "abcdefgh"[4]); return 0; }
Hence the output is 'e'.
#include<stdio.h> int main() { union a { int i; char ch[2]; }; union a u; u.ch[0] = 3; u.ch[1] = 2; printf("%d, %d, %d\n", u.ch[0], u.ch[1], u.i); return 0; }
So the output is 3, 2, 515.
#include<stdio.h> int main() { int X=40; { int X=20; printf("%d ", X); } printf("%d\n", X); return 0; }
#include<stdio.h> int main() { char c=48; int i, mask=01; for(i=1; i<=5; i++) { printf("%c", c|mask); mask = mask<<1; } return 0; }
#include<stdio.h> int main() { char str = "CuriousTab"; printf("%s\n", str); return 0; }
To eliminate the error, we have to change the above line to
char *str = "CuriousTab"; (or) char str[] = "CuriousTab";
Then it prints "CuriousTab".
#include<stdio.h> int main() { static char s[25] = "The cocaine man"; int i=0; char ch; ch = s[++i]; printf("%c", ch); ch = s[i++]; printf("%c", ch); ch = i++[s]; printf("%c", ch); ch = ++i[s]; printf("%c", ch); return 0; }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.