+ 1
#include <iostream> using namespace std; int main() { int a=1 ,b; a=b; cout << b+a; return 0; }
Why this code outputs 16
8 Antworten
+ 1
b has an undefined value that happens to be 8.
+ 6
Zen is there any specific reason why it has value of 8 only?
I tried playing with the code a bit but everytime the undefined var has value of 8 meaning it isn't random 🤔
+ 2
First you assign 1 to a
Then you make b equal to a so b now is 1
cout << b+a prints the sum of a and b => a=1; b=1 ==> a+b =2
+ 1
//नमस्ते
#include <iostream>
using namespace std;
int main()
{
int a=1 ,b;
b=a;
cout << b+a;
return 0;
}
//this code outputs 2
+ 1
You haven't initialized b in your code.
+ 1
PLease explain above code whose output is 16
+ 1
Yes i am also thinking the same
But as i did not completed everything in c++ ,i hope to understand it latter
0
Yes I did not initialised b, but how the output fetch 16??