edited by
1,151 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
edited by

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.

Related questions

1 votes
1 votes
2 answers
1
go_editor asked Mar 26, 2020
1,504 views
After $3$ calls of the $c$ function bug ( ) below, the values of $i$ and $j$ will be :int j = 1; bug () { static int i = 0; int j = 0; i++; j++; return (i); }$i = 0, j = ...
1 votes
1 votes
8 answers
2
go_editor asked Mar 26, 2020
2,328 views
Find the output of the following $“C”$ code :Main() { int x=20, y=35; x=y++ + x++; y=++y + ++x; printf (“%d, %d\n”, x, y); }$55, 93$$53, 97$$56, 95$$57, 94$