Consider the following array declaration: int arr[4] = {2, 4, 5}; What will be the output of the following 'C' statement? printf("%d", 3[arr]);

Consider the following array declaration: int arr[4] = {2, 4, 5}; What will be the output of the following 'C' statement? printf("%d", 3[arr]); Correct Answer 0

The correct answer is option 1.

Concept:

Array:

 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. It also has the capability to store the collection of derived data types, such as pointers, structure, etc. The array is the simplest data structure where each data element can be randomly accessed by using its index number.

Explanation:

The given 

int arr = {2, 4, 5};

[ alt="F1 Harshita11-2-22 Savita D5" src="//storage.googleapis.com/tb-img/production/22/02/F1__Harshita11-2-22_Savita_D5.png" style="width: 206px; height: 79px;">

Here By default, when we create an array of something in C all entries will have their default value. For primitive types like int, long, float the default value is zero.

Hence the correct answer is 0.

Related Questions

A teacher asked the class to subtract 5 from 75.70% of the class said: 25. Their work was shown as: \(\begin{array}{*{20}{c}} {\begin{array}{*{20}{c}} 7&5 \end{array}}\\ {\underline {\begin{array}{*{20}{c}}\ { - 5} \ \ \ &{} \end{array}} }\\ {\underline {\begin{array}{*{20}{c}} 2&5 \end{array}} } \end{array}\) Which of the following describes the most appropriate remedial action that the teacher should take to clarify this misconception?