——Rex's Blog,Westlife歌迷,Linuxer
自写函数,实现字符串比较.若字符串中字符不同,则输出两者的ASCII码差值
#include <stdio.h> int strcmp(char *p1,char *p2) { int i,h,j,k; for (i=0;p1[i]!='\0' || p2[i]!='\0';i++) { if (*(p1+i)!=*(p2+i)) { h=(int)*(p1+i); j=(int)*(p2+i); k=h-j; return k; } } printf("The same word\n"); return 0; } int main() { char s1[100],s2[100]; int result; printf("Please input the first word:\n"); gets(s1); printf("Please input the second word:\n"); gets(s2); result=strcmp(s1,s2); printf("%d",result); return 0; }
alipay
Dreamhost
Http Error
Linux
Nginx
Opera
Our Story
PHP
The Love Album
WHMCS
WinRAR
Wordpress
三坊七巷
天使
如果云知道
思念
搬家
教程
杂文
漏洞
笔记
自定义PHP.INI
花开的诺言
随想
青春 C (9)
Nginx (4)
Our Story (27)
The Love Album (13)
教程 (19)
杂文 (7)
随想 (24)
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.