Consider the following array declaration in the 'C' language:
int array 1[] = {2, 3};
int array2[3]={9};
What will be the output of the following print statement?
printf(“%d, %d”, array1 [1], array2 [2]);
'C' भाषा में नीचे दिए गए ऐरे (array) डिक्लेरेशन पर विचार करें:
int array1[] = {2, 3};
int array2[3]={9};
नीचे दिए गए प्रिंट स्टेटमेंट का आउटपुट क्या होगा?
printf(“%d, %d”, array1 [1], array2 [2]);
Key Points
An array is defined as the collection of similar types of data items stored at contiguous memory locations. Arrays are the derived data type in C programming language which can store the primitive type of data such as int, char, double, float, etc. C array is beneficial if you have to store similar elements.
Array can be access i th index at array A,
A[ i ]= i [ A ] = *(A+ i) = *(i + A)
Given that,
int array1[ ] = {2, 3);
int array2[ 3 ] = {9};
printf(“%d, %d”, array1[1], 2[array2]);
array1 is dynamic allocation of {2,3}.
array2 is three memory cells and stores 9 at 0th index of array2.

printf(“%d, %d”, array1[1], 2[array2]);
array1[1]= 1st index at array1 = 3
array2 [2]= 2nd index at array2 = 0
Hence the correct answer is 3, 0.
मुख्य बिंदु
ऐरे को एक-जैसे डेटा आइटम के कलेक्शन के रूप में परिभाषित किया जाता है जो लगातार मेमोरी लोकेशन पर स्टोर होते हैं। ऐरे C प्रोग्रामिंग भाषा में डिराइव्ड डेटा टाइप हैं जो int, char, double, float आदि जैसे प्रिमिटिव टाइप के डेटा को स्टोर कर सकते हैं। C ऐरे तब फायदेमंद होता है जब आपको एक-जैसे एलिमेंट स्टोर करने हों।
ऐरे A के i-वें इंडेक्स को इस तरह एक्सेस किया जा सकता है:
A[ i ]= i [ A ] = *(A+ i) = *(i + A)
दिया गया है,
int array1[ ] = {2, 3};
int array2[ 3 ] = {9};
printf(“%d, %d”, array1[1], 2[array2]);
array1, {2,3} का डायनामिक एलोकेशन है।
array2 में तीन मेमोरी सेल हैं और यह array2 के 0-वें इंडेक्स पर 9 स्टोर करता है।

printf(“%d, %d”, array1[1], 2[array2]);
array1[1]= array1 का पहला इंडेक्स = 3
array2 [2]= array2 का दूसरा इंडेक्स = 0
इसलिए सही उत्तर 3, 0 है।
Exam Preparation Simplified
Trusted by 8.1 Crore+ Students