#include <iostream>
//compute Lenght Of String Without Any Other Variable
using namespace std;
int len(char a[])
{
if(*a == '\0')
{
return 0;
}
else
{
return len(++a) + 1;
}
}
int main()
{
char a[] = "hello";
int i = len(a);
cout << "len: " << i << endl;
getchar();
return 0;
}
阅读(551) | 评论(0) | 转发(0) |