⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch27-6.c

📁 C语言程序设计上机指导与练习 冶金工业出版社 刘怀亮
💻 C
字号:
#include "stdio.h"
strcmp(p1,p2) 
char *p1,*p2; 
{ 
   int i; 
   i=0; 
   while(*(p1+i)==*(p2+i)) 
	    if(*(p1+i++)=='\0') return(0); 
   return(*(p1+i)-*(p2+i)); 
} 

void main() 
{ 
   int m; 
   char str1[20],str2[20],*p1,*p2; 
   printf("Input two strings(1 string at each line):\n"); 
   scanf("%s",str1); 
   scanf("%s",str2); 
   p1=&str1[0]; 
   p2=&str2[0]; 
   m=strcmp(p1,p2); 
   printf("The result of comparison :%d\n",m); 
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -