in Programming in C
297 views
0 votes
0 votes

https://gateoverflow.in/8283/gate2015-1-35

how x+3 and *(x+3) printing the same output

in Programming in C
by
297 views

2 Comments

even though the output look same, they are really different

it is a two dimensional array. ===> collection of 1-D arrays

x ===> 0th 1-D

x+3 ==> 4th 1-D

*(x+3) = *(x+3) + 0 ====> 4th 1-D, 0th element Address

But the printing was same due to memory address of 4th 1-D = memory address of  4th 1-D, 0th element Address.

1
1

i thought that x+3 will give the address of the pointer that is pointing to 4th 1-D array.....106(assumed)

0
0

1 Answer

0 votes
0 votes
X+3 is the address of 4th 1-d array, while.   ( *(x+3) +0) is the address of first element of the 4th 1-d array, they both refers to the same address.