UGC NET CS 2010 June-Paper-2
October 18, 2023GATE 2004
October 19, 2023GATE 2011
Question 10 |
What does the following fragment of C-program print?
char c[] = "GATE2011"; char *p =c; printf("%s", p + p[3] - p[1]) ;
GATE2011 | |
E2011 | |
2011 | |
011 |
Question 10 Explanation:
p is the starting address of array.
p[3] – p[1] = 4, and p+4 will be pointing to the fifth position in the array ‘c’. So printf starts printing from 2 and prints 2011.
p[3] – p[1] = 4, and p+4 will be pointing to the fifth position in the array ‘c’. So printf starts printing from 2 and prints 2011.
Correct Answer: C
Question 10 Explanation:
p is the starting address of array.
p[3] – p[1] = 4, and p+4 will be pointing to the fifth position in the array ‘c’. So printf starts printing from 2 and prints 2011.
p[3] – p[1] = 4, and p+4 will be pointing to the fifth position in the array ‘c’. So printf starts printing from 2 and prints 2011.
Subscribe
Login
0 Comments