strcmp()
• This function compares two strings (variables / constants) and returns integer value.
• The prototype of function is in header file string.h
• Syntax
int strcmp(const char*s1,const char*s2);
where s1 and s2 are two strings.
• The function compares string s2 with string s1.
• If s1s2, it returns value greater than zero.
• While comparing it compares ASCII value of symbol
• Example
a = strcmp(a1,a2);
This compares two string variables a1 and a2.
b = strcmp(“mouse”, “Mouse”);
This compares two string constants.
• This function compares two strings (variables / constants) and returns integer value.
• The prototype of function is in header file string.h
• Syntax
int strcmp(const char*s1,const char*s2);
where s1 and s2 are two strings.
• The function compares string s2 with string s1.
• If s1
No comments:
Post a Comment