Tag Archives: strcmp()

strcmp() explained perfectly

code:

 

c library function strcmp()

http://www.cplusplus.com/reference/cstring/strcmp/

http://www.tutorialspoint.com/c_standard_library/c_function_strcmp.htm

for the pseudocode: http://stackoverflow.com/questions/12136329/how-does-strcmp-work

http://en.cppreference.com/w/c/string/byte/strncmp

example:

here we are actually comparing the contents of lhs and contents of rhs that is passing from the main function.

declaration can be done by this in nay function

int strcmp(const char* str1,const char* str2)

algorithm should be like this:

Two things to remember we are defining here the address value not the length of the string and so it is the comparison between contents of the strings not the length . 🙂