第一种,没有分配单元,第二种,过于复杂了,而且没有充分用到字符串函数,把以上两种综合一下
#include "stdio.h"
main()
{
char str1[50],str2[50],str3[50],str4[50];
char *s1,*s2,*s3,*max;
s1= str1;s2=str2;s3=str3;max=str4;
scanf("%s",s1);
scanf("%s",s2);
scanf("%s",s3);
if(strcmp(s1,s2)<0) strcpy(max,s2);
else strcpy(max,s1);
if(strcmp(max,s3)<0) strcpy(max,s3);
printf("%s\n",max);
}
温馨提示:答案为网友推荐,仅供参考