字符串和字符数值的区别(sizeof)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_39642794/article/details/83864121

#include <stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
char x[]="abcdefg";
char y[]={'a','b','c','d','e','f','g'};
int xlen;
int ylen;
xlen=sizeof(x);
ylen=sizeof(y);
printf("xlen=%d ylen =%d\n",xlen,ylen);
return 0;
}

xlen=8 ylen =7

猜你喜欢

转载自blog.csdn.net/qq_39642794/article/details/83864121
今日推荐