C语言中的strlen函数可以测量字符串的长度,比如测 char a[]="china"; char b[]={"china"}; 那么它可以测 char c[]={'c','h','i','n','a'};的长度吗?char d[]={'c','h','i','n','a','\0'};呢?#include<stdio.h>void main(){char a[]="china";char b[]={"china"};char c[]={'c','h','i','n','a'};char d[]={'c','h','i','n','a','\0'};printf("a=%d\nb=%d\nc=%d\nd=%d\n",strlen(a),strlen(b),strlen(c),strlen(d));getch();} 这个程序的结果是:a=5b=5c=11d=5
添加回答
举报
0/150
提交
取消