in Programming in C edited by
1,108 views
3 votes
3 votes
Main()
{ char *str="abcde";
printf("%c",*str);
printf("%c",*str++);
printf("%c",*(str++));
printf("%s",str);
}

The output of the above $‘C’$ code will be :

  1. $\text{a a c b c d e}$
  2. $\text{a a c c c d e}$
  3. $\text{a a b c d e}$
  4. None of these
in Programming in C edited by
1.1k views

2 Answers

2 votes
2 votes
Correct ans is (C.): a a b c d e is the correct order of Output.

Take address of str =100.

Because in *str(*100) it will print "a" then, *str++ will print "a" again and increment str by 1(Now str is 101). It will print "b" and increment str by 1 again(Now str is 102). At last it will print whole string from *102 as format specifier is %s so c d e is printed.
0 votes
0 votes

the answer is $(D)$ output is $aabcde$

please add the missing printf statement in the code displayed after the question.

1 comment

that option is actually $(C)$
0
0

Related questions