String in strcmp() function:
in cproframs strcmp() function are Depended Ascii Value.
0:if both strings are identical (equal)
negative: if the ASCII value of first unmatched character is less than second.
positive integer:if the ASCII value of first unmatched character is greater than second.
#include<stdio.h>
#include<conio.h>
void main()
{
char name[]="abcd",name1[]="abcD",name2[]="abcd";
int result;
clrscr();
result=strcmp(name,name1);
printf("strcmp(name and name1)=%d\n",result);
result=strcmp(name,name2);
printf("strcmp(name and name2)=%d\n",result);
getch();
}
Output:
EmoticonEmoticon