#include "stdafx.h"
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
char *str1="abcde";
char str2[]="abcde";
char str3[8]={'a',};
sizeof(str1);
sizeof(str2);
sizeof(str3);
cout<<"sizeof(str1):"<<sizeof(str1)<<endl<<"sizeof(str2):"<<sizeof(str2)<<endl
<<"sizeof(str3):"<<sizeof(str3)<<endl;
return 0;
}
C语言字符数组sizeof
最新推荐文章于 2024-11-04 22:09:53 发布
本文详细解释了在C++中如何使用sizeof运算符比较字符串大小,并通过实例展示了具体操作。
4169

被折叠的 条评论
为什么被折叠?



