I am trying to convert an unsigned long using the sprintf function in c. Code goes like:
char ID[6];
sprintf(ID,"%lu",a.id);
a.id
is a number that is passed in that can range from 0 > but I only want the first 6 regardless. Using printf("%lu",a.id);
prior to conversion prints the right number but once I try print the string from the char the outcome is 0
. Not too sure why this is happening any advice would be much appreciated.