C++ output type question
Q. Trace the output.
void main ( )
{
char s[ ] = "CLASS";
int i;
for (i=0; s[i]; i++)
cout << "\n" << s[i] << *(s+i) << *(i + s) << i[s];
}
- Published on 17 Jun 15a.
C
L
A
S
S
b.
CLASS
CLASS
CLASS
CLASS
CLASS
c.
CCCC
LLLL
AAAA
SSSS
SSSS
d. None of the above.
ANSWER:
CCCC
LLLL
AAAA
SSSS
SSSS