求大佬帮忙解决!
#include<stdio.h>#include<string.h>
main()
{
#define MAX_CHANGDU 5
#define MAX_MINGZI 64
int i,j;
int ia,ib;
char name={"张三","李四","王五","老大","老二"};
int score={75,85,55,65,95};
printf("排序前:\t");
for(i=0;i<MAX_CHANGDU;i++)
{
printf("%s,%d ",name,score);
}
printf("\n");
for(i=0;i<MAX_CHANGDU;i++)
{
ia=score;
ib=i;
for(j=i+1;j<MAX_CHANGDU;j++)
{
if(score<ia)
{
ia=score;
ib=j;
}
}
score=score;
score=ia;
strcpy(name,name);
strcpy(name,ia);
}
printf("排序后:\t");
for(i=0;i<MAX_CHANGDU;i++)
{
printf("%d ",score);
}
return 0;
}
到最后会提示:
warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
warning C4024: 'strcpy' : different types for formal and actual parameter 2
应该怎么解决啊 一个元素的赋值不要strcpy BngThea 发表于 2018-3-25 21:42
一个元素的赋值不要strcpy
{:10_266:}不用strcpy要怎么解决赋值想的我脑阔痛 文墨书生 发表于 2018-3-25 21:49
不用strcpy要怎么解决赋值想的我脑阔痛
直接用=
页:
[1]