Is it possible to declare a four bit integer with 16 possible values. I know you can create 8-bit using uint8 from stdint.h
Does anyone know how to do this? I need a 4 bit integer because i'm working on a project with very strict memory constraints and I should be able to cut down on memory usage considerably if I can fill my arrays with 4 bit integers.
Assume char datatype is 8 bits, then you can make use of that to store two 4 bit integer. Now the tricky part is to read/write to this char datatype. I would presume you may want to create a class or a set of functions to help manipulation of a char as if it consist of two 4 bit integer.
Basically you use the built-in bitwise operator to play around with the char to extract the different 4 bit integer values inside.