October 27, 2024
Chicago 12, Melborne City, USA
C++

Should I use char for a signed int in C?


If the integer value I want to store is only requiring 1 signed byte, should I use a char or a short for the variable type?

If the program was for a limited hardware system, I would obviously want to use a char for memory efficiency, but should I favour the potentially more readable short if the program is for a system with negligible effect? Or would it be considered common knowledge enough that a char represents a signed byte?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video