Question
Option 4 : 5 / 5
Detailed Solution
सही उत्तर 5 / 5 है।
Question:
What is the output of the following C code? `int a[] = {1, 2, 3, 4, 5}; printf("%d", sizeof(a) / sizeof(a[0]));` / निम्नलिखित C कोड का आउटपुट क्या होगा? `int a[] = {1, 2, 3, 4, 5}; printf("%d", sizeof(a) / sizeof(a[0]));`
Correct Answer: 5 / 5
`sizeof(a)` is 5 × 4 = 20 bytes and `sizeof(a[0])` is 4 bytes, so the division yields the element count 5. The trap is printing `sizeof(a)` alone (20) or assuming the array decays to a pointer here — it does not, because `sizeof` is one of the exceptions. / `sizeof(a)` है 5 × 4 = 20 बाइट और `sizeof(a[0])` है 4 बाइट, अतः भाग देने पर तत्वों की संख्या 5 मिलती है। जाल अकेले `sizeof(a)` (20) को छापना है, या यह मानना कि array यहाँ pointer में decay होगा — नहीं होगा, क्योंकि `sizeof` उन अपवादों में से एक है।