2 votes 2 votes garimanand asked Nov 15, 2018 garimanand 701 views answer comment Share Follow See all 12 Comments See all 12 12 Comments reply Show 9 previous comments Shivam Kasat commented Nov 16, 2018 reply Follow Share They ain't going to ask such question which cause ambiguity. 0 votes 0 votes Lakshman Bhaiya commented Nov 16, 2018 i edited by Lakshman Bhaiya Nov 16, 2018 reply Follow Share #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 votes 1 votes Mahbub Alam commented Nov 16, 2018 reply Follow Share How to understood which one should be executed first? 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes Answer is 2 and 50 Rackson answered Jan 22, 2019 Rackson comment Share Follow See all 0 reply Please log in or register to add a comment.
–1 votes –1 votes Getting 250 Hemanth_13 answered Nov 15, 2018 Hemanth_13 comment Share Follow See all 3 Comments See all 3 3 Comments reply garimanand commented Nov 16, 2018 reply Follow Share how do you know to follow right to left convention rather than left to right 0 votes 0 votes Hemanth_13 commented Nov 16, 2018 reply Follow Share 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 votes 0 votes garimanand commented Nov 16, 2018 reply Follow Share 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 votes 0 votes Please log in or register to add a comment.