#include "stdafx.h"
void int2str(int num, char *s);
int _tmain(int argc, _TCHAR* argv[])
{
int a = 1234 ;
char *s = (char *) malloc(sizeof(char)*10);
int2str(a, s);
//cout << s <
return 0;
}
void int2str(int num, char *s)
{
int len = 0;
char temp;
while (num)
{
*(s++) = num%10 + '0';
num = num/10;
len ++;
}
*(s) = '/0';
s = s- len ;
for (int i = 0; i < len/2; i++)
{
temp = *(s + i);
*(s + i) = *(s + len - 1 -i);
*(s + len - 1 -i) = temp;
}
}