How would I take a lowercase char and make it uppercase using the ASCII table?
How would I take a lowercase char and make it uppercase using the ASCII table?
That should print A to the screen, not a. Be sure to include ctype.hCode:char c = 'a'; toupper(c); cout<<c<<endl;
pointer = NULL
If your going to use the Ascii table you could understand that
a lower case char and with 0x5f will convert a lower case to an upper case.
example:
char letter = 'a';
letter = letter & 0x5f;
cout<<letter<<endl;
and you can conver upper to lower by
letter = letter | 0x20;
basically all you are doing it flipping the sixth bit of the ascii code.
Bit twiddling hurts portability, unless you plan to use the program only on your own computer it's really best to use the 'one size fits all' functions. Though knowing how to play with bits is nice to know.
pointer = NULL
Won't bit flipping mess with characters that aren't letters?
All generalizations are false