Skip to main content
Light editing
Source Link
chux
  • 157.7k
  • 17
  • 160
  • 310

It is implementation-defined (i.e. up to the compiler) isif char is signed or unsigned. Also, whenever a type smaller than int is used in an arithmetic expression, it will be promoted to an int.

And since the promotion will do sign-extension a, the signed char will be promoted to the value -1, but an unsigned will be promoted to the value 255.

This is a major reason all character reading functions return an int, so they can be directly compared to the int value EOF.


Because of the implementation-defined nature of char, there are actual three different types for char, unlike all other integer types:

  1. signed char
  2. unsigned char
  3. char.

When a char is promoted to an int, the value needs to stay the same. So -1 is still -1, and 255 is still 255.

It is implementation-defined (i.e. up to the compiler) is char is signed or unsigned. Also, whenever a type smaller than int is used in an arithmetic expression, it will be promoted to an int.

And since the promotion will do sign-extension a signed char will be promoted to the value -1, but an unsigned will be promoted to the value 255.

This is a major reason all character reading functions return an int, so they can be directly compared to the int value EOF.


Because of the implementation-defined nature of char, there are actual three different types for char, unlike all other integer types:

  1. signed char
  2. unsigned char
  3. char.

When a char is promoted to an int, the value needs to stay the same. So -1 is still -1, and 255 is still 255.

It is implementation-defined (i.e. up to the compiler) if char is signed or unsigned. Also, whenever a type smaller than int is used in an arithmetic expression, it will be promoted to an int.

And since the promotion will do sign-extension, the signed char will be promoted to the value -1, but an unsigned will be promoted to the value 255.

This is a major reason all character reading functions return an int, so they can be directly compared to the int value EOF.


Because of the implementation-defined nature of char, there are actual three different types for char, unlike all other integer types:

  1. signed char
  2. unsigned char
  3. char.

When a char is promoted to an int, the value needs to stay the same. So -1 is still -1, and 255 is still 255.

added 391 characters in body
Source Link
Some programmer dude
  • 411.4k
  • 36
  • 420
  • 655

It is implementation-defined (i.e. up to the compiler) is char is signed or unsigned. Also, whenever a type smaller than int is used in an arithmetic expression, it will be promoted to an int.

And since the promotion will do sign-extension a signed char will be promoted to the value -1, but an unsigned will be promoted to the value 255.

This is a major reason all character reading functions return an int, so they can be directly compared to the int value EOF.


Because of the implementation-defined nature of char, there are actual three different types for char, unlike all other integer types:

  1. signed char
  2. unsigned char
  3. char.

When a char is promoted to an int, the value needs to stay the same. So -1 is still -1, and 255 is still 255.

It is implementation-defined (i.e. up to the compiler) is char is signed or unsigned. Also, whenever a type smaller than int is used in an arithmetic expression, it will be promoted to an int.

And since the promotion will do sign-extension a signed char will be promoted to the value -1, but an unsigned will be promoted to the value 255.

This is a major reason all character reading functions return an int, so they can be directly compared to the int value EOF.


Because of the implementation-defined nature of char, there are actual three different types for char, unlike all other integer types:

  1. signed char
  2. unsigned char
  3. char.

It is implementation-defined (i.e. up to the compiler) is char is signed or unsigned. Also, whenever a type smaller than int is used in an arithmetic expression, it will be promoted to an int.

And since the promotion will do sign-extension a signed char will be promoted to the value -1, but an unsigned will be promoted to the value 255.

This is a major reason all character reading functions return an int, so they can be directly compared to the int value EOF.


Because of the implementation-defined nature of char, there are actual three different types for char, unlike all other integer types:

  1. signed char
  2. unsigned char
  3. char.

When a char is promoted to an int, the value needs to stay the same. So -1 is still -1, and 255 is still 255.

Source Link
Some programmer dude
  • 411.4k
  • 36
  • 420
  • 655

It is implementation-defined (i.e. up to the compiler) is char is signed or unsigned. Also, whenever a type smaller than int is used in an arithmetic expression, it will be promoted to an int.

And since the promotion will do sign-extension a signed char will be promoted to the value -1, but an unsigned will be promoted to the value 255.

This is a major reason all character reading functions return an int, so they can be directly compared to the int value EOF.


Because of the implementation-defined nature of char, there are actual three different types for char, unlike all other integer types:

  1. signed char
  2. unsigned char
  3. char.