+ 1
What happens if I just declare the variable "sum" but don't put the initial value? For instance, if instead of saying "int sum = 0;" , I said " int sum;"
3 Respuestas
0
Generally the initial value of integer is a random number, not sure -2. Usually it's a rather long number like 16437843 or -854270. You can easily make sure of it with this code:
int arr[20];
for (int i = 0; i < 20; ++i)
cout << arr[i] << endl;
0
The initial value depends on the compiler implementation.
0
It gives an error as undefined variable as it is declared but not defined