Consider the following array declaration in ‘C’ language:
int array[] = {2, 3, 4, 5};
What will be the output of the following statement?
printf("%d", 2[array]);
Correct Answer is 4.
🔑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.
int array[] = {2, 3, 4, 5};
The above array at index I can be accessed by, a[i], i[a], *(a+i) or *(i+a) all the above representations all are equal and gives the i th index value.
printf(%d', 2[array]); So, it gives the 2nd index value. i.e 4.
Hence the correct answer is 4.
📄 Additional Information
Program:
#include
int main()
{
int arr[] = { 2, 3, 4, 5 };
printf("%d ",arr[2]);
printf("%d ",2[arr]);
printf("%d ",*(2+arr));
printf("%d ",*(arr+2));
return 0;
}
Output: 4 4 4 4
So above given 2nd index value is 4 for all above print statements.

