395 views
2 votes
2 votes

Please explain the output.

#include<stdio.h>

int main()

{

  int c;

  printf("geeks for %ngeeks ", &c);

  printf("%d", c);

  getchar();

  return 0;

}

1 Answer

1 votes
1 votes
Output would be "geeks for" followed by some garbage value...%n in printf statement specifies print all the charcters before the occurence of %n

Related questions

2 votes
2 votes
1 answer
1
Sugumaran asked Feb 7, 2018
494 views
#include<stdio.h int main() { int x=191; char *p; p=(char*)&x; printf("%d",*p); }explain it
3 votes
3 votes
1 answer
2
just_bhavana asked Jan 18, 2018
1,537 views
#include<stdio.h int main() { char arr[5][7][6]; char *p[5][7][6]; printf("%d\t", (unsigned)(arr+1)-(unsigned)arr); printf("%d", (unsigned)(p+1)-(unsigned)p); }Please enl...
3 votes
3 votes
1 answer
3
5 votes
5 votes
3 answers
4
suvasish pal asked Aug 26, 2017
626 views
Will it result in to an error if a header file is included twice?[A].Yes[B].No[C].It is compiler dependent