3 votes 3 votes main( ) { int n[3][3] = { 2, 4, 3, 6, 8, 5, 3, 5, 1 } ; printf ( "\n%d %d %d", *n, n[3][3], n[2][2] ) ; } Programming in C programming-in-c pointers programming output + – Parshu gate asked Nov 13, 2017 Parshu gate 1.4k views answer comment Share Follow See all 15 Comments See all 15 15 Comments reply Show 12 previous comments Ashwin Kulkarni commented Nov 13, 2017 reply Follow Share @Hemant the first element is " *n " so it should give the value of the 1st element of the array. If only " n " will be there then it will print its address! Tell me If I am wrong! Thanks in advance. 0 votes 0 votes Rishabh Gupta 2 commented Nov 13, 2017 reply Follow Share I am getting garbage, garbage, 1. 0 votes 0 votes cprdereddyy commented Mar 7 reply Follow Share remember this when we say 'n' it is '&n' 'n[i]' is equivalent to ' *(n +i ) ' reference : yashavant kanetkar in the case of 1D array if we say *n -> *(n+0) -> n[0] which is an integer then we can get the value in that place in the case of 2D array if we say *n -> n[0] in the case of 2D array it is still an array so we get the adress of the first 1D array so we'll dereference it again this time we get the value of the integer stored in [0][0] i don't know to what extent i am correct the main observation i observed is if n[i] is an integer we can get that if n[i] is an array we get the adress of the array 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes 2, garbage, 1 Ashwin Kulkarni answered Nov 13, 2017 Ashwin Kulkarni comment Share Follow See all 2 Comments See all 2 2 Comments reply joshi_nitish commented Nov 13, 2017 reply Follow Share it is *n, which will return address, if it would be **n, then the first value printed would be 2 0 votes 0 votes Ashwin Kulkarni commented Nov 13, 2017 reply Follow Share Ohk. Got it! Thank you :) 0 votes 0 votes Please log in or register to add a comment.