0 votes 0 votes void main() { int i=10, j=2; int *ip= &i, *jp = &j; int k = *ip/*jp; printf(“%d”,k); } Programming in C programming-in-c pointers + – Desert_Warrior asked May 15, 2016 Desert_Warrior 660 views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply srestha commented May 15, 2016 reply Follow Share Ans 5 1 votes 1 votes Desert_Warrior commented May 15, 2016 reply Follow Share no i executed the code. Its gives an error. It assumes that Fifth line has comment. /* 1 votes 1 votes srestha commented May 15, 2016 reply Follow Share ok yes ,we have to write it with bracket int k = (*ip)/(*jp); 0 votes 0 votes Please log in or register to add a comment.
Best answer 3 votes 3 votes IN LINE 5 the compiler treats the operatorsequence / and * as /* which happens to be the starting ofcomment SO IT GENERATES SYNTAX ERROR:UNEXPECTED END OF FILE. HERE IS THE REFERENCE(MAXIMAL MUNCH) https://en.wikipedia.org/wiki/Maximal_munch asu answered May 15, 2016 • selected May 15, 2016 by Desert_Warrior asu comment Share Follow See all 4 Comments See all 4 4 Comments reply Desert_Warrior commented May 15, 2016 reply Follow Share but if I place space between / and * ; execution is fine and 5 is printed. Correct me if I'm wrong. 0 votes 0 votes asu commented May 15, 2016 reply Follow Share yes u r rt.a white space or using like this [x=y/(*z);] will print 5 0 votes 0 votes rajan commented May 15, 2016 reply Follow Share @lord krishna bcz if u seprate / * by a space then they treat as *jp . but if u r not doing seprate by using space then they treat like as starting of comment 0 votes 0 votes Amit Prakash Tiwari commented Sep 16, 2016 reply Follow Share So operator precedence rule fail here.beacuse unary operator * has more precendece then '/' operator. Is this the only case where the rule fail? 0 votes 0 votes Please log in or register to add a comment.