#include <iostream>
#include<cstring>
using namespace std;
int main()
{
char** a[3][4];//一个指针占4个字节,数组存放的是指针类型char**/int**
int** a1[3][4];
char* b[3];//指针数组
int* b1[3];
int c[3];//整型数组
int d[] = {1, 2, 3};
const char* str = "i love you!";
cout<<str[0]<<endl;//i
cout<<strlen(str)<<endl;//11 strlen()遇到空字符结束
cout<<sizeof(str)<<endl;//4
cout<<sizeof(int)<<endl;//4
cout<<sizeof(long long)<<endl;//8
cout<<sizeof(long)<<endl;//4
cout<<sizeof(a)<<endl;//48
cout<<sizeof(a1)<<endl;//48
cout<<sizeof(b)<<endl;//12
cout<<sizeof(b1)<<endl;//12
cout<<sizeof(c)<<endl;//12
cout<<sizeof(d)<<endl;//12
return 0;
}
sizeof 指针和数组
猜你喜欢
转载自blog.csdn.net/weixin_40804971/article/details/82721278
今日推荐
周排行