/*
*Copyright (c) 2014, 烟台大学计算机学院
*All rights reserved.
*文件名称:test.cpp
*作者:陈栋梁
*完成日期:2014年 12月 16 日
*版本号:v1.0
*
*问题描述:
*/
#include <iostream>
using namespace std;
int astrlen(char s[]);
int main()
{
char s[50]="Hello world Good morning vegetable bird!";
cout<< astrlen(s) << endl;
return 0;
}
int astrlen(char s[])
{
int i;
for(i=0;s[i]!='\0';++i);
return i;
}
运行结果: