I know this thread is "a little bit" old, but i would like if you can help me.
Im using sprintf(). This is my code:
int countDigits(int inteiro,int max){
char *string;
string = (char *) calloc(max+1,sizeof(char));
sprintf(string,"%d",inteiro);
return strlen(string);
}
However if the first digit of "inteiro" is a 0, this function doesnt count it. I wonder why?
(sorry about my eventual bad english)