+ 1

Still having problems in for loop Nd postfix/prefix,is there any easy way to understand?

25th Jun 2018, 10:15 AM
Apoorv singh
Apoorv singh - avatar
3 odpowiedzi
0
what is the problem with postfix and prefix operator??? Prefix increments the value, and then proceeds with the expression. Postfix evaluates the expression and then performs the incrementing For e.g. for prefix operator int z= (++i); // given i is 5 Sopln(z); // value z is now 6 for postfix operator int z= (i++); // given i is 5 Sopln(z); // value z is now 5 after again u wll use with d same variable name i it wll print 6 Another e.g. int a= (++i)+(i++)+(++i); // given i = 5 Sopln(a); // ans wll print 8 bcz firstly der is prefic so it wll increase d value by 1 so it store 6 den further when we go to next step der is postfix operator so it wll print same value bcz postfic increase d value in next step n again when we go to i der is prefix operator so it wll print 7 and before step we use postfix operator so further it wll inrease by one so ans coming 8 // hope u get it ur problem
25th Jun 2018, 10:56 AM
Harsh Agrawal
Harsh Agrawal - avatar
0
Harsh Agrawal Is there any easier way to understand the for loop in multi-dimensional array?
25th Jun 2018, 6:45 PM
Apoorv singh
Apoorv singh - avatar
0
Sorry Apoorv singh I dont know much about array!!!!!😓
26th Jun 2018, 7:35 AM
Harsh Agrawal
Harsh Agrawal - avatar