#include <stdio.h>
#include <string.h>
#define MAX_SIZE 1024
char *number_change_string(int num,char *src)
{
int i = 0;
int len;
char temp;
while(num != 0)
{
src[i] = num % 10 + '0';
num = num / 10;
i++;
}
src[i] = '\n';
len = strlen(src);
for(i = 0; i < len/2; i++)
{
temp = src[i];
src[i] = src[len - i - 1];
src[len - i - 1] = temp;
}
}
int main()
{
int num;
char src[MAX_SIZE];
printf("input the number:\n");
scanf("%d",&num);
number_change_string(num,src);
printf("the string is %s\n",src);
return 0;
}
#include <string.h>
#define MAX_SIZE 1024
char *number_change_string(int num,char *src)
{
int i = 0;
int len;
char temp;
while(num != 0)
{
src[i] = num % 10 + '0';
num = num / 10;
i++;
}
src[i] = '\n';
len = strlen(src);
for(i = 0; i < len/2; i++)
{
temp = src[i];
src[i] = src[len - i - 1];
src[len - i - 1] = temp;
}
}
int main()
{
int num;
char src[MAX_SIZE];
printf("input the number:\n");
scanf("%d",&num);
number_change_string(num,src);
printf("the string is %s\n",src);
return 0;
}