数组名和数组名取地址区别:
设int S[5] = {1,2,3,4,5};则S是数组的首地址(意思是数组首个元素的地址) ; &S是数组的地址。虽然值相同,但意义不同,从s+1和&s+1可知道其深层意义。
- {
- int num[5] = {1,2,3,4,5};
- cout<<num<<endl;
- cout<<num+1<<endl;
- cout<<&num<<endl;
- cout<<&num+1<<endl;
- }
数组名和数组名取地址区别:
设int S[5] = {1,2,3,4,5};则S是数组的首地址(意思是数组首个元素的地址) ; &S是数组的地址。虽然值相同,但意义不同,从s+1和&s+1可知道其深层意义。