Re: [algogeeks] GATE 2011 C Ques

2011-07-02 Thread sameer.mut...@gmail.com
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

Re: [algogeeks] GATE 2011 C Ques

2011-07-02 Thread abhijith reddy
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]

[algogeeks] GATE 2011 C Ques

2011-07-02 Thread KK
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