Reputation: 6058
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 since
int test = 0
would be like that?
Upvotes: 0
Views: 911
Reputation: 873
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
Upvotes: 0
Reputation: 471229
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.
Upvotes: 3