0

This is when I try to output uninitialized characters on the screen. I thought C++ should declare all of them to 0's (or '\0' for characters) when I declare them without initializing?

Attachments pretty_picture.png 111.07 KB
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by NathanOliver
0

The c++ standard gives no guarantee that a variable will be initialized to zero or null. Some compilers may add this functionality in but it is not guaranteed. You should always initialize your variables when you declare them. This is especially true for counter variables.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.