I was wondering whether it would be better to store and use data as char or int, since char uses only 8 bits and you could do stuff like say 'char a = 0x0F;' and then write it to a file, writing specific binary data to store info, or even use it as variables for arithmetic that only required smaller containers as opposed to using 32 bit int. However, I have also read that on 32-bit or 64-bit machines using smaller containers actually causes the program to run slower since it reads and writes in 32-bits, so maybe using an int type would be more efficient?
Basically it comes down to two questions, first is it better to use char in a program as an 8-bit number instead of using a larger int variable when 2^32 values are not needed or is nothing saved like this?
Second, is it better to store data into char variables and write to files in this form, or is it faster to use int 32-bit data type?
Thanks for any input,
Brian