0
can numbers ( 1, 2, 13, 25 ... ) be char data types ?
4 Respostas
+ 3
yes, char myChars =['1','2','3','4'};
alternatively if you say something like
char ch = 97;
cout << ch; will print a, and not 97 since 97 is the ascii code for a
+ 2
as an addition of destro's answer remember
range of
char = -128 to 127
unsigned char = 0 to 255
0
}else if(y != 1 && y != 0){
cout << "error" << endl;
return 0;
}
now y is an int type and if user types a it always takes it as 0 can i set y to char type and the user can text xyz or a number like 23 and it will cout error ?
0
unsigned int or int data type..