Diff in strcmp and stricmp

strcmp (s, t) compares the strings and returns a negative, zero or positive if s is lexicographically less than, equal to, or greater than t. The value is obtained by subtracting the characters at the first position where s and t disagree.

stricmp performs the same function as strcmp, but alphabetic characters are compared without regard to case. That is, "A" and "a" are considered equal by stricmp, but different by strcmp.

Examples:
a.out>strcmp("apple", "peach");
-15
a.out> strcmp("peach", "apple");
15
a.out> strcmp("Apple","Apple");
0
a.out> strcmp("Apple","Apple pie");
-32
a.out> strcmp("Apple","apple");
-32
a.out> stricmp("Apple","apple");
0

Comments

Popular posts from this blog

shriranga kamalakanta

Deva Gharache dnyat kunala

Hindu aikya ghosh