Code:
#include <stdio.h>
int main()
{
int iVal = 0x12345678;
char cVal = 0x9a;
short sVal = 0xbcde;
unsigned char msg[15];
bzero(msg,sizeof(msg));
sprintf(msg,"%x%x%x",iVal,cVal,sVal);
printf("%s",msg);
}
output :
12345678ffffff9affffbcde
i donot understand why i get "fffff" in between the varaibles in msg.
i know these are all might be very trivial for some people here, before posting here i indeed try a bit in the google when confirmed that the things i found are not satisfactory or confirmatiory i post here.
thanks friends for all your knowledge sharing