Hello everyone!I'm a beginner in C programming. I'd like to ask if there is any way that I can use a char array to simulate a int variable. As I knew char use 1 byte and int type using 4bytes.
I tried:
int a=10;
char b[4];
for (int i=0;i<4;i++)
b[i]=(char)a;
but when i print out the char array, nothing is shown on the screen.
* I only included <stdio.h>
The char type holds a byte of information, it's true. What this means is that you can represent either 0 to 255 (unsigned) or -128 to 127 (signed) in integral representation with it.