Question
1.
2.
3.
4.
Answer (Detailed Solution Below)
Option 3 : 6 4 / 6 4
Advertisement
Detailed Solution
सही उत्तर 6 4 / 6 4 है।
Key Points
Helpful?
Question:
What is the output of the following C program involving pointer arithmetic? / पॉइंटर अंकगणित वाले निम्नलिखित C प्रोग्राम का आउटपुट क्या होगा?
#include <stdio.h> int main() { int a[5] = {2, 4, 6, 8, 10}; int *p = a; p += 2; printf("%d %d", *p, *(p - 1)); return 0; }
1.
4 6 / 4 6
2.
6 8 / 6 8
3.
6 4 / 6 4
4.
2 4 / 2 4
Correct Answer: 6 4 / 6 4
After p += 2, p points to a[2], which is 6, and *(p - 1) is a[1], which is 4. / p += 2 के बाद p, a[2] यानी 6 की ओर इशारा करता है, और *(p - 1) यानी a[1] का मान 4 है।
Downloaded from PrepSnap (prepsnap.in)