Reputation: 111
The char
data type can store numbers, characters, and symbols, so what is the need for the int
data type?
char = '2';
I have knowledge of use of int
, but I want to know the conceptual part to describe it fundamentally.
Upvotes: 1
Views: 307
Reputation: 29952
Usually, int
can hold larger numbers than char
. In current, widely available architectures, int
is 32-bit, while char
is 8-bit. Furthermore, it is implementation defined that a char
is signed or unsigned.
On these architectures int
can hold numbers between -2147483648 and 2147483647, while a (signed) char
can hold numbers between -128 and 127.
Upvotes: 2