urgent help needed with itoa
Hi
I need help with implementing itoa function as below. What is wrong with my below code? It has compilation errors.
Code:
#include <stdio.h>
#include <math.h>
#include <string.h>
void itoa (const int input, char* output){
int i, sign;
if((sign = input) <0)
input = -input;
i =0;
do{
output[i++] = input %10 + '0';
}while ((input /= 10) > 0);
if(sign <0)
output[i++] = '-';
output[i] = '\0';
reverse(output);
}
int main (){
char buf[13];
itoa(-23456, buf);
printf("My Output: %s\n", buf);
}