assume the integer>0
GetInt(char *strint, int val){
int i, temp = val, len = 1;
//count the length of val
while((val /= 10)>0)
len++;
//write char in array
strint[len] = '\0';
for(i = len-1; i >= 0; i--){
strint[i] = temp % 10 + 48;
temp /= 10;
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment