Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 2 : 50

Advertisement

Detailed Solution

सही उत्तर 50 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

What does the following C pointer-arithmetic program output? / पॉइंटर अंकगणित वाले निम्नलिखित C प्रोग्राम का आउटपुट क्या है?

#include <stdio.h> int main() { int a[] = {10, 20, 30, 40}; int *p = a; printf("%d", *(p + 2) + p[1]); return 0;}

1.
40
2.
50
3.
60
4.
30

Correct Answer: 50

*(p + 2) is a[2] = 30 and p[1] is a[1] = 20; 30 + 20 = 50. / *(p + 2), a[2] = 30 है और p[1], a[1] = 20 है; 30 + 20 = 50।

Downloaded from PrepSnap (prepsnap.in)