I am trying to make a search proceedure based on a name given by the user but the condition is always false. I have tried the function strcmp(); but it compares only the numerical values of the strings so i dismissed it. Any suggestions to make the comparisson work?
In the code that you show you're comparing the addresses of two pointers, and not the actual contents of them. It's strange that 'strcmp' didn't work for you, since it's supposed to tell you when two strings are equal. One of the mistakes I did when I was new to C was to think that 'strcmp' returned 1 if the strings were equal, while it actually returns 0 if two strings are equal. Might that be the problem?
string1 is equal to string2
int num = strcmp(string1, string2);
strings are equal
else if(num < 1)
string2 is greater than string1 //note the direction of
//the < (big "mouth", facing string2)
string1 is greater than string 2 //string1 now has the "big mouth" of the > symbol