1 1 vote #include<stdio.h> int main() { static int GATE[]={100,200,300,400,500}; static int *p[] = {GATE+2, GATE, GATE+3, GATE+4, GATE+1}; int **ptr = p; ptr++; printf("%d", *ptr); return 0; } How answer is 500 , i'm getting garbage or NA. Programming in C programming-in-c + – ASUR 564 views answer comment Share Follow Print See 1 comment 1 1 comment reply shc commented Oct 17, 2025 i edited by shc Oct 17, 2025 reply Follow flag Where did you get this question from? This question is stupid. See my answer below for the reason this question is stupid. –1 –1 replyShare Please log in or register to add a comment.
2 2 votes In its current form it will not actually print the address of GATE array, because "%d" conversion specifier has been used in the printf statment. %d is used to print integers, not address.Also C standard doesn't specify what should happen when conversion specifier and argument mismatch, hence running this program may lead to undefined behaviour.This is from KN King C programming a second approach, 2nd edition.Hence I commented that this question is stupid. shc answered Oct 17, 2025 • edited Oct 17, 2025 by shc shc comment Share Follow See all 3 Comments 3 3 Comments reply ASUR commented Oct 17, 2025 reply Follow flag @Shcs111OOh understood thankyou bro for ur efforts . 0 0 replyShare shc commented Oct 17, 2025 reply Follow flag You are welcome :) But where did you get this question from? 0 0 replyShare ASUR commented Oct 17, 2025 reply Follow flag From gate zeal sheet 0 0 replyShare Please log in or register to add a comment.
1 1 vote This is printing address of GATE, ie. address of 100. For actually printing 100, the line should be - printf("%d", **ptr); So yes, running this program gets address of GATE which looks like a garbage value mv_ind answered Oct 17, 2025 mv_ind comment Share Follow See 1 comment 1 1 comment reply ASUR commented Oct 17, 2025 reply Follow flag yes if there is **ptr then surely it will print. I think there is maybe typo. 1 1 replyShare Please log in or register to add a comment.