check the syntax of "strncmp"
int strncmp ( const char * str1, const char * str2, size_t num );
where str1
is the C string to be compared, str2
is the C string to be compared and num
is the maximum number of characters to compare.
I think introducing the third variable num
i.e the maximum no of character you want to compare will solve your problem.