ASCII value of 'A' is 65 and Asciivalue of 'E' is 69.
69-65=4
On Sat, Jul 2, 2011 at 7:12 PM, abhijith reddy wrote:
> p[3] = 'E'
> p[1] = 'A'
> p[3]-p[1] = 4
> ?
>
>
> On Sat, Jul 2, 2011 at 7:10 PM, KK wrote:
>
>> 10. What does the following fragment of C-program print?
>>
>> char c[] = "GATE20
p[3] = 'E'
p[1] = 'A'
p[3]-p[1] = 4
?
On Sat, Jul 2, 2011 at 7:10 PM, KK wrote:
> 10. What does the following fragment of C-program print?
>
> char c[] = "GATE2011";
> char *p =c;
> printf("%s", p + p[3] - p[1]);
>
> (A) GATE2011 (B) E2011 (C) 2011 (D) 011
> Answer: - (C)
>
> why is p[3] - p[1]
10. What does the following fragment of C-program print?
char c[] = "GATE2011";
char *p =c;
printf("%s", p + p[3] - p[1]);
(A) GATE2011 (B) E2011 (C) 2011 (D) 011
Answer: - (C)
why is p[3] - p[1] returning 4
--
You received this message because you are subscribed to the Google Groups
"A