linux下的vim下;
返回值为前面的字符串的减去后面字符串的值;
vs2019下:
#include<iostream>using namespace std;int main(){ char ch[] = "asdasd"; char ch2[] = "asdasd"; char ch3[]= "asdas2"; char ch4[] = "asdasd123"; int num = strcmp(ch, ch2); int num2 = strcmp(ch, ch3); int num3= strcmp(ch, ch4); cout << num << endl; cout << num2 << endl; cout << num3 << endl;}
等于返回0;第一个大于第二个返回1,小于返回-1;