2 votes 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 asked Oct 20, 2018 Na462 2.0k views answer comment Share Follow See all 12 Comments See all 12 12 Comments reply Shaik Masthan commented Oct 20, 2018 reply Follow Share option A... what is the problem you are facing while answering? 0 votes 0 votes Na462 commented Oct 20, 2018 reply Follow Share 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 votes 0 votes Shaik Masthan commented Oct 20, 2018 reply Follow Share check the answer https://gateoverflow.in/254355/test-series-question 0 votes 0 votes Na462 commented Oct 21, 2018 reply Follow Share Brother say in question something like int q = (int **)arr would have been written then q value would be 10 right ? 0 votes 0 votes Shaik Masthan commented Oct 21, 2018 reply Follow Share you declared q as integer pointer,===> single pointer (int **)arr is a double pointer, then how can you assign it to q ? 0 votes 0 votes Na462 commented Oct 22, 2018 reply Follow Share 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 votes 0 votes Shaik Masthan commented Oct 22, 2018 reply Follow Share 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 votes 2 votes altamash commented Nov 19, 2018 reply Follow Share can u explain??? how output is8,10 0 votes 0 votes Shaik Masthan commented Nov 19, 2018 reply Follow Share 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 votes 2 votes Indhuja68 commented Jul 13, 2021 reply Follow Share 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 votes 0 votes Indhuja68 commented Jul 13, 2021 reply Follow Share Why are we converting arr to single pointer? 0 votes 0 votes Shaik Masthan commented Jul 13, 2021 reply Follow Share 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 votes 0 votes Please log in or register to add a comment.