֪ Ŀ Lib Ƶ iPerson γ ֤ ѯ Modeler   Code  
Ա   
Ҫ
 
 

CԽ̳
CVSװ
CԵһ
CԳִ
Cprintf()scanf()
C
CԹؼ
C
CԿ
Cif-else
Cswitch
Cdo-whileѭ
Cwhileѭ
Cforѭ
Cbreak
Ccontinue
Cgoto
Cֵͨú
CԵݹ
CԴ洢
C
C
CԶά
CԽ鴫ݸ
Cָָ
Cgets()puts()
Cstrlen()
Cstrcpy()
Cstrcat()
Cstrcmp()
Cstrrev()
Cstrlwr()
Cstrupr()
CԽṹ
CԽṹ
CԽṹǶ
C
ļ
Cfprintf()fscanf()
Cfputc()fgetc()
Cfputs()fgets()
Cfseek()
Crewind()
Cftell()
Ԥ
CԤָ
C#includeָ
C#defineָ
C#undefָ
C#ifdefָ
C#ifndefָ
C#ifָ
C#errorָ
C#pragmaָ
 
 

Cstrcmp()
222
1  
 

strcmp(first_string, second_string)Ƚַַȣ򷵻0

ʹgets()ӿ̨ȡַȽϡ

ʹʾ

һԴļstring_strcmp.cʾ -

#include <stdio.h>
void main()
{
char str1[20], str2[20];
while(1){
printf("Enter 1st string: ");
gets(str1);//reads string from console
printf("Enter 2nd string: ");
gets(str2);
if (strcmp(str1, str2) == 0)
printf("Strings are equal \n");
else
printf("Strings are not equal \n");
}
}

ִʾ룬õ½ -

Enter 1st string: mystr
Enter 2nd string: mystr
Strings are equal
Enter 1st string: string1
Enter 2nd string: string2
Strings are not equal

 

 

 

 

 


Ծ֧ǵĹҵ

10Ԫ 50Ԫ





֤룺 ֤,?ˢ֤



222
1