2 2 votes Programming in C + – garimanand 2.1k views answer comment Share Follow Print See all 12 Comments 12 12 Comments reply Show 9 previous comments Shivam Kasat commented Nov 16, 2018 reply Follow flag They ain't going to ask such question which cause ambiguity. 0 0 replyShare Lakshman Bhaiya commented Nov 16, 2018 i edited by Lakshman Bhaiya Nov 16, 2018 reply Follow flag #include<stdio.h> int main() { int a[] = {10, 20, 30, 40, 50}; int *p[] = {a+1, a, a+4, a+3, a+2}; int **ptr = p; ptr++; printf("%d%d", ++ptr-p, **ptr); } the answer should be $210$ #include<stdio.h> int main() { int a[] = {10, 20, 30, 40, 50}; int *p[] = {a+1, a, a+4, a+3, a+2}; int **ptr = p; ptr++; printf("%d", ++ptr-p); printf("%d", **ptr); } the answer should be $250$ 1 1 replyShare Mahbub Alam commented Nov 16, 2018 reply Follow flag How to understood which one should be executed first? 0 0 replyShare Please log in or register to add a comment.
0 0 votes Answer is 2 and 50 Rackson answered Jan 22, 2019 Rackson comment Share Follow 0 reply Please log in or register to add a comment.
–1 –1 vote Getting 250 Hemanth_13 answered Nov 15, 2018 Hemanth_13 comment Share Follow See all 3 Comments 3 3 Comments reply garimanand commented Nov 16, 2018 reply Follow flag how do you know to follow right to left convention rather than left to right 0 0 replyShare Hemanth_13 commented Nov 16, 2018 reply Follow flag That is by convention that I have been following for all the problems, haven't find any issue yet and most of the compiler follow the same convention. The logic that I had is the printf starts execution from " (left double quote) and if it has any string to print it prints and if there is any format specifier it it goes to value part( after "(right double quote)) and gets the value and prints it on the o/p screen if the another found then it goes for the next value part. for example: int i=1; printf("%d %d",i++,i); //1 2 is displayed 0 0 replyShare garimanand commented Nov 16, 2018 reply Follow flag try to do this ans will be 2 2 0 #include <stdio.h> int main(void) { int i=0; printf("%d %d %d",i,++i,i++); return 0; } 0 0 replyShare Please log in or register to add a comment.