一个例子解释“数组名"的含义

```
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{

     char str[]="hello";
      cout << sizeof(str)<<endl;  //数组名代表整个数组的大小,值为首元素的地址


     char ds[5][5] ={"hell","jin"};//与上同理
     cout << sizeof(ds)<<endl;

    char *arg[] = {"h","k"};   //指针数组 
    cout << arg[1][0]<<endl;
    cout << *((*(arg +1))+0)<<endl;
     cout <<sizeof(arg)<<endl; 


     int data[4][4] = {'2','3','3','3'};
     cout <<sizeof(data)<<endl;


     int int_st1[] = {'1','3'};
     int int_st2[]  ={'2','3'};
     int *data1[2] = {int_st1,int_st2};
     cout << sizeof(data1)<<endl;
     return 0;
}

6
25
k
k
8
64
8
Press any key to continue

“`

你可能感兴趣的:(数组,sizeof)