question about identifier

char Character or small integer. 1byte signed: -128 to 127
unsigned: 0 to 255
short int (short) Short Integer. 2bytes signed: -32768 to 32767
unsigned: 0 to 65535
int Integer. 4bytes signed: -2147483648 to 2147483647


I read this on this tutorial here.
I want to know what does range means here
like char is -128 to 127 , so does it mean that we can store this much numbers in it or does it mean that we can store any numbers between these two numbers ?
And I want to in which identifier can we store aplha bats and in which can we store on numbers ??
char -128 to 127 means that the char type can store any ascii integer value from -128 to 127. If you want to you can store a number as a character and then cast it back into an integer for use.

In answer to your question... You can only store ONE number with a value between -128 and 127 with a signed char. A character technically holds a number which represents an ASCII character.

A char holds both an alpha character and a number simultaneously. You can convert a letter over to its ASCII equivalent at any time.

An integer holds only a number though.

The range you wrote above is the range that ONE number or char can be in before the data type overflows.
Last edited on
please give examples what types of number and alpha can we store in char and what type we can't ??
char can hold only numbers, from -128 to 127 if unsigned or from 0 to 255 if signed.
The number stored in a char is converted into a character by using its ASCII equivalent.
You can assign a character constant to a char eg: 'a' is the same as 0x61 or 97.

A char with the same value could look different depending on the character encoding
eg: char(0xB1)
OEM: ▒
ANSI: ±



http://www.cplusplus.com/doc/ascii.html
http://www.cplusplus.com/doc/tutorial/constants.html
Topic archived. No new replies allowed.