mardi 3 novembre 2020

What is the difference between char ch and char ch = 0?

I'm reading through chapter 10 of Stroustrup's PPP and the example he uses here when reading files:

http://www.c-jump.com/bcc/c155c/c155Stxtbook2nd/Chapter10/chapter_10_11_2_cpp.htm

When he's reading the temperature, I noticed that he uses char ch1; and char ch2;

However, when he's reading the month, I saw that he does char ch = 0;

I was wondering, what is the purpose of initializing char ch = 0; when he didn't do that in the previous function? Does it make any difference?

Aucun commentaire:

Enregistrer un commentaire