#include "stdafx.h"
#include "iostream"
using namespace std;
using namespace System;
int strcmp1(char *source,char *dest)
{
for(int i=0;i<=strlen(source);i++)
{
if(*source!=*dest)
{
return 1;
}
source++;
dest++;
}
return 0;
}
int main(array ^args)
{
if(!strcmp1("hello","helle"))
{
cout<<"TRUE"<<endl;
}
else
{
cout<<"FALSE"<<endl;
}
system("pause");
return 0;
}
在上边的代码中i=3的时候就会跳出循环,不明白,strlen(source)不是等于5么,为什么3就跳出循环了