p[3] = 'E'
p[1] = 'A'
p[3]-p[1] = 4
?
On Sat, Jul 2, 2011 at 7:10 PM, KK <[email protected]> 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] returning 4 ????
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.