Setting Char variables
For a char variable would i also set it to 0 as i would set and int or a float or any other variable?
Such as
char test = 0
would it be like that开发者_如何学C since
int test = 0
would be like that?
Which do you want? The character '0', or the ascii 0?
If you want to set it to the character '0', then you need:
char test = '0';
If you want the ascii value 0, then it's fine the way it is.
You can always use type conversions in c++, so even if you write int test = 0 you can access its ascii by converting it into char, this goes without saying for chars
精彩评论