Open In App

GATE | GATE MOCK 2017 | Question 22

Like Article
Like
Save
Share
Report

What will be the output produced by the following C code:

int main()
{
    int array[5][5];
    printf("%d",( (array == *array) && (*array == array[0]) ));
    return 0;    
}

(A) 1
(B) 0
(C) 2
(D) -1


Answer: (A)

Explanation:
Given is a 2d array array[5][5].
Suppose base address of array is 2000

array = 2000
*array = 2000

array[0] = 2000

So expression is something like 2000==2000 && 2000==2000 i.e. 1&&1 will return 1.



Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads