Variable initialization in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Variable initialization in c++

I know that in C you need to initialize while declearing. Does it also apply to c++?

1st Oct 2020, 4:11 PM
‫רון סיידר‬‎
‫רון סיידר‬‎ - avatar
1 Answer
+ 1
No. You don't need to. You only initialize a variable if the next immediate action you take on that variable is reading the value it contains.
1st Oct 2020, 4:44 PM
Anthony Maina
Anthony Maina - avatar