mercredi 20 novembre 2019

why my int is initialized with a random value?

i am a beginner with C++ and i have a little probleme. I have already coded a lot with C and i never meet this probleme before. When i execute this code :

int line;
cout << line << endl;

sometimes the result is 0 as expected but sometimes it give a big random number like 32638 for example , does anyone know where that issue can come frome ? Also i tryed with : int line = 0; and it work but im curious of why do i have to do this for my int to be initialized to 0.




Aucun commentaire:

Enregistrer un commentaire