int x = 12 ; int y= ++x ; cout << x ; . In this what is the output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

int x = 12 ; int y= ++x ; cout << x ; . In this what is the output

Please answer

20th Jun 2018, 4:29 PM
Superman Batman
Superman Batman - avatar
10 Answers
+ 4
x is 13 due to the ++x. it increments x by 1. btw you can use the code playground.. heres a lesson.. https://www.sololearn.com/learn/CPlusPlus/1610/
20th Jun 2018, 4:30 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 1
y will be 13
20th Jun 2018, 4:33 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
0
and
20th Jun 2018, 4:31 PM
Superman Batman
Superman Batman - avatar
0
y
20th Jun 2018, 4:31 PM
Superman Batman
Superman Batman - avatar
0
y will also be 6?
20th Jun 2018, 4:32 PM
Superman Batman
Superman Batman - avatar
0
#include <iostream> using namespace std; int main() { int x= 12; int y = x += 1;. //equivalent to y = ++x cout<<x<<y<<endl; return 0; } y will be 13. try above code for better understanding.
20th Jun 2018, 4:38 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
0
thank you
21st Jun 2018, 2:14 AM
Superman Batman
Superman Batman - avatar
0
13
22nd Jun 2018, 1:26 PM
huyu
0
y=++x ++x=13 so y=13 and x increases itself so x=13
29th Jun 2018, 4:16 PM
vivek patel
vivek patel - avatar
0
y=++x ++x=13 so y=13 and x increases itself so x=13
29th Jun 2018, 4:17 PM
vivek patel
vivek patel - avatar