1

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.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Drashti
  • 111
  • 2
  • 12

1 Answers1

2

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.

geza
  • 28,403
  • 6
  • 61
  • 135