C
Programming and Technical
Programming
Output
main()
{
char *str = "12345";
printf("%c %c %cn", *str, *(str++), *(str++));
}
Read Solution (Total 7)
-
- The contents in printf are stored in the form of stack. So first right most variable i.e *(str++) is executed which prints '1' and address gets incremented.next *(str++) executes which prints '2' and finally executes*str which prints '3'.printing of values is done same as given in the printf function.
So output is 321. - 9 years agoHelpfull: Yes(3) No(0)
- pls explain clearly the output of pgm
- 9 years agoHelpfull: Yes(1) No(0)
- {
char *str = "12345";
printf("%c %c %cn", *str, *(str++), *(str++));
} - 8 years agoHelpfull: Yes(1) No(0)
- str gives startin address of string
str++ gives 1st position after start
and again str++ gives second position from start
so the answer i think is 123 - 9 years agoHelpfull: Yes(0) No(0)
- The output of d given program z 3 2 1.Bcoz execution/operation strats from right to left.
- 9 years agoHelpfull: Yes(0) No(0)
- Answer will be 3 2 1
- 9 years agoHelpfull: Yes(0) No(0)
- in string we have to take "12345" then why you take only 1 instead of all it means "12345"
- 8 years agoHelpfull: Yes(0) No(0)
C Other Question