国产成人AV一区二区三区在线_国产成人精品无码免费看_国产成人无码无卡在线观看_国产精品成人A区在线观看_国产日韩精品欧美一区_国产亚洲精品自在久久蜜TV_久草热久草热线频97精品_久久久噜噜噜久久中文福利_久久婷婷五月综合色国产免费观看_日日狠狠久久偷偷色综合0,九一桃色在线观看,久久97精品久久久久久久不卡,国产成人精品亚洲精品

c語(yǔ)言while循環(huán)的問(wèn)題

訪客2023-12-06 11:25:188

#include"stdafx.h"char strcmp( char* a0 , char* a1){ int ret = 2;char *SizeofArr = a0;char* SizeofArr1 = a1;int SA =0 ;int SA1 =0; int SACMP =0;while (*SizeofArr++){SA++ ;}while (*SizeofArr1++){SA1++ ;}if (SA == SA1){while ((*a0++) == (*a1++))//此語(yǔ)句while 兩者參數(shù)為0,為什么還不結(jié)束?{SACMP ++;}if(SA1==SACMP){ret = 1 ;}else{ret = 0 ;}}printf("%d",ret);return ret;}int main(){char arr[] = {"China"};char arr1[]= {"China"};strcmp (arr,arr1);return 0;}

你要了解

0 == 0 表達(dá)式的值為1

所以當(dāng)while(0==0)時(shí),循環(huán)仍會(huì)執(zhí)行的

正確的可以是(你算法本身有冗余的)

while ((*a0) && ((*a0++) == (*a1++))) //a0或a1不能為0的

文章評(píng)論