How to ANSI-C cast from unisigned int * to char *?
Posted
by user314290
on Stack Overflow
See other posts from Stack Overflow
or by user314290
Published on 2010-04-12T07:31:53Z
Indexed on
2010/04/12
7:43 UTC
Read the original article
Hit count: 272
I want these two print functions to do the same thing:
unsigned int Arraye[] = {0xffff,0xefef,65,66,67,68,69,0};
char Arrage[] = {0xffff,0xefef,65,66,67,68,69,0};
printf("%s", (char*)(2+ Arraye));
printf("%s", (char*)(2+ Arrage));
where Array is an unsigned int. Normally, I would change the type but, the problem is that most of the array is numbers, although the particular section should be printed as ASCII.
© Stack Overflow or respective owner