0
Hi why we use x+1 please
7 Respuestas
+ 1
Where?
• Please be specific with your question.
• Attach code link or lesson link with which you have doubt.
+ 1
x+1 or i+1 or in fact with any variable, this will increase value of that that variable by 1 but it won't store it to the variable.
int x = 5;
cout << x + 1; //this will print 6
cout << x; //but value of x is still 5.
• Now if you want to change value of x with increment by 1 you have to re-initialize it.
int x = 5;
x = x + 1;
cout << x; //now this will print 6
+ 1
In my opinion it is a very powerful statement if we initialize x=5. And
x=x+1;
And if it runs automatically it causes the value to increment .it also reduces large lines of codes.
0
Ok
0
[i+1]
0
Something like this
0
Tnx bro