【求助】 字符串问题
#include<stdio.h>char *sax[4][4]=
{
{"m","m","m","m"},
{"cm","d","cd","c"},
{"xc","l","xl","x"},
{"ix","v","iv","i"},
};
int nums[4][4]={
{1000,1000,1000,1000},
{900,500,400,100},
{90,50,40,10},
{9,5,4,1}
};
void xue(int x,char *result)
{
int i,j;
for(i=0;i<4;i++)
for(j=0;j<4;j++)
while(x>=nums[i][j])
{
strcat(result,sax[i][j]);
x-=nums[i][j];
}
}
int main()
{
int num;
char result[35];
result[0]='\0';//为什么不加这句话会发生错误的??????不理解···
scanf("%d",&num);
xue(num,result);
printf("%s",result);
return 0;
}