Forum Discussion
Altera_Forum
Honored Contributor
15 years agoC CODE Integer as ASCII to printf string...HELP!!!
Hi all, As like the title, now i have an unsigned integer that contain 4 ASCII code for a string: 0x41424344--------- my unsigned integer I would like to print the out "ABCD" where th...
Altera_Forum
Honored Contributor
15 years agoUse a cast.
unsigned int my_integer = 0x41424344; char * c = (char*)&my_integer; Then you can use stuff like this printf("%c%c%c%c", c[3], c[2], c[1], c[0]);