Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

do c++ ints neeed to be initlaized

tldr; Yes, or you risk getting a random number as the starting value.

For automatic variables:
Some compilers might do it but the standard does not require it. A conforming implementation could leave them to be uninitialized garbage values.

For static variables:
They must be initialized to zero unless explicitly initialized otherwise.
 
PREVIOUS NEXT
Tagged: #ints #neeed #initlaized
ADD COMMENT
Topic
Name
8+9 =