2 2 votes What is the Output of following Array ? A. 8 10 B. 10 8 C. 10 2 D. 8 1 E. Garbage value Programming in C programming-in-c array + – Na462 3.2k views answer comment Share Follow Print See all 12 Comments 12 12 Comments reply Shaik Masthan commented Oct 20, 2018 reply Follow flag option A... what is the problem you are facing while answering? 0 0 replyShare Na462 commented Oct 20, 2018 reply Follow flag I got the answer right though i am confused at q = (int*)arr part how *q is giving 10 as arr is 3 dimensional please clear me at this point 0 0 replyShare Shaik Masthan commented Oct 20, 2018 reply Follow flag check the answer https://gateoverflow.in/254355/test-series-question 0 0 replyShare Na462 commented Oct 21, 2018 reply Follow flag Brother say in question something like int q = (int **)arr would have been written then q value would be 10 right ? 0 0 replyShare Shaik Masthan commented Oct 21, 2018 reply Follow flag you declared q as integer pointer,===> single pointer (int **)arr is a double pointer, then how can you assign it to q ? 0 0 replyShare Na462 commented Oct 22, 2018 reply Follow flag No brother that's not what i meant i said that suppose i declared an identifier as ' int q ' then what will be the value of q = (int**)arr // because (int*)arr will be address of 1st element of 1d array so will (int**)arr will fetch the value ? 0 0 replyShare Shaik Masthan commented Oct 22, 2018 reply Follow flag because (int*)arr will be address of 1st element of 1d array so will (int**)arr will fetch the value ? (int **) means you are making it as double pointer. Brother, understood the difference between (int **)arr and **arr (int **)arr -------- making it to the double pointer. **arr ---- dereferencing the double pointer will (int**)arr will fetch the value ? * (int *)arr ----> will fetch the value 2 2 replyShare altamash commented Nov 19, 2018 reply Follow flag can u explain??? how output is8,10 0 0 replyShare Shaik Masthan commented Nov 19, 2018 reply Follow flag Note that index starts with 0. p = &a[1][1][1] ===> p points to the 1st index element of 1st index 1-D of 1st index 2-D ==> *p = 8 q = (int *) a ===> q points to 0th index element of 0th index 1-D of 0th index 2-D ===> *q = 10 2 2 replyShare Indhuja68 commented Jul 13, 2021 reply Follow flag What happens if I declare int **q = (int **)a; Please can anyone explain this?I think it's showing segmentation fault.But why? Please anyone could tell? 0 0 replyShare Indhuja68 commented Jul 13, 2021 reply Follow flag Why are we converting arr to single pointer? 0 0 replyShare Shaik Masthan commented Jul 13, 2021 reply Follow flag check the link shared by me. for your second doubt, in the question, it asked like that so we did , but not by us. 0 0 replyShare Please log in or register to add a comment.