初中生
最后登录1970-1-1
在线时间 小时
注册时间2018-10-8
|
发表于 2018-10-8 16:11:52
|
显示全部楼层
#include <stdio.h>
#include <string.h>
int main(void)
{
char str[15]="hello world";
char strn[]="hello world";
char *p=str;
char *pn=strn;
printf("%d\n",sizeof(str));//¿aê¼¾í·ÖÅäáË15¸ö×Ö½ú
printf("%d\n",sizeof(strn));
printf("\n");
printf("%d\n",strlen(str));//×Ö·û¸öêy2»°üà¨'\0'
printf("%d\n",strlen(strn));
printf("\n");
printf("%d\n",sizeof(p));//Ö¸Õë×Ö½úêy4»ò8
//sizeof(*********p)=4;
printf("%d\n",sizeof(pn));
printf("\n");
printf("%d\n",strlen(p));//×Ö·û¸öêy2»°üà¨'\0'
printf("%d\n",strlen(pn));
}
结果:
15
12
11
11
4
4
11
11
|
|