Answer the question
In order to leave comments, you need to log in
Why are created variables not null in c++?
Hey!
There is this code in c++:
#include <iostream>
using namespace std;
int main()
{
int a,b,c,d;
cout << "a = " << a << "\n"; // a = 379757328
cout << "b = " << b << "\n"; // b = 32764
cout << "c = " << c<< "\n"; // c = 0
cout << "d = " << d << "\n"; // d = 0
return 0;
}
Answer the question
In order to leave comments, you need to log in
Because you considered the chapter of the C ++ textbook about creating variables and initializing them to be nonsense. When creating a variable on the stack in C++, the memory location that the variable looks at does not change its value. Therefore, there is garbage to meet at times. if the initial value of the variable is important to you - initialize the variable MANUALLY)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question