Skip to content
Related Articles

Related Articles

GATE | GATE MOCK 2017 | Question 22
  • Last Updated : 06 Jan, 2017

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

sudo-gate-course

My Personal Notes arrow_drop_up
Recommended Articles
Page :