x =-1 because length of str1 is less than length of str2.
y = 1 because length of str2 is greater than length of str1.
z = 0 because length of str2 is equal to length of str3.
strcmp() is case sensitive string comparison so the output of below code is 1 ( not 0 )
#include <stdio.h>
#include <string.h>
int main(void){
char str2[]="plus2net";
char str3[]="Plus2net"; // Watch the first char P
int z;
z=strcmp(str2,str3);
printf("Output: %d",z);
return 0;
}
Output
1
If the string matches then you will get 0 as output , but if strings are not matching you may get more than 1 or less than -1 as output ( based on difference in string1 and string2 ) depending upon your Operating system.
Example : In place of -1 , you may get -32 or in place of +1 , you may get 55