I want to use strcmp(); in my program.
I have read that it needs two string constants.
If I have a string say string1, and string2. I input data into it and add a trailling \0. Does adding the trailing \0 create the string constant? My book states it has to be a string enclosed in "string". Can we not use a string scaned in by sscanf? I want to compare the two strings with the following syntax.
sample program... sorry no compiler to check
Code:#include<string.h> #include<stdio> char string1; char string2; memset(string1,'\0',99); memset(string2,'\0',99); int x; scanf("%s%s",string1,string2); x=strcmp(string1,string2); printf("%i",x);