#include
#include
int main()
{
char e[] = "zhongbei";
char f[] = "zhonghua";
printf("字符串e为:");
puts(e);
printf("字符串f为:");
puts(f);
printf("%d\n", strcmp(e, f)); //输出-6, strcmp()函数的返回值是个int,所以前面要加%d
if (strcmp(e, f) > 0)
printf("e > f\n");
else
printf("e < f\n");
return 0;
}
输出结果:strcmp结果小于0,说明e排在f前面