main()
{char S[]="ABCDEFGH";
printf("%c",*(&S[3]));
printf("%s",S+4);
printf("%u",S);
/* base address of S is 1000.*/
}
A) ABCDEFGH1000 B)CDEFGH1000 C)DDEFGHH1000 D)DEFGH1000.
Answer D.
Explanation.
S[0]=A at address 1000.
S[1]=B at address 1001.
S[2]=C at address 1002.
S[3]=D. at address 1003.
S[4]=E. at address 1004.
S[5]=F
S[6]=G
S[7]=H.
printf("%c",*(&S[3])); prints character at subscript S[3].
printf("%s",S+4); prints from base address 1000+4.
printf("%u",S); prints base address.
{char S[]="ABCDEFGH";
printf("%c",*(&S[3]));
printf("%s",S+4);
printf("%u",S);
/* base address of S is 1000.*/
}
A) ABCDEFGH1000 B)CDEFGH1000 C)DDEFGHH1000 D)DEFGH1000.
Answer D.
Explanation.
S[0]=A at address 1000.
S[1]=B at address 1001.
S[2]=C at address 1002.
S[3]=D. at address 1003.
S[4]=E. at address 1004.
S[5]=F
S[6]=G
S[7]=H.
printf("%c",*(&S[3])); prints character at subscript S[3].
printf("%s",S+4); prints from base address 1000+4.
printf("%u",S); prints base address.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.