Hi,
This is a simple code i've attempted.
Since char occupies 1 byte, n1 occupies 1 byte.Code:void main() { char n1 = 10; printf("n1 is %d.",n1); }
But in the printf(), n1 is converted into an int (4 bytes). So will the program reserve 4 bytes for n1?
I'd like to know if there's a way to display a small number stored in a char variable without converting it to int in the printf(), i.e. without using %d.
I've tried %c, but it doesnt display 10 as required.
The only point of asking this question is how to code this program so that it occupies minimum memory.....to the extent of saving even 3 bytes.
Thank you
Nikhil