JavaShuo
欄目
標籤
int *ptr=(int *)(&a+1)
時間 2020-12-26
原文
原文鏈接
昨晚有小夥伴問了一道題,感覺挺經典的。 1 int a[5] = {1, 2, 3, 4, 5}; 2 3 int *ptr = (int *) (&a + 1); 4 5 printf("%d %d \n\r", *(a + 1), *(ptr - 1) ); 從內存分佈的角度來解析: &a和a做右值時的區別: &a是整個數組的首地址,而a是數組首元素的首地址。這兩個在數字上是相等的
>>阅读原文<<
相關文章
1.
指針和引用(int*、int&、int*&、int&*、int**)
2.
指針和引用---int*、int&、int*&、int&*、int**
3.
int const*與int * const
4.
int indexs=(int)(_v+0.5);
5.
void (*f(int, void (*)(int)))(int) 函數解析
6.
簡化void(*signal(int signum, void(*handler)(int)))(int)
7.
String的indexOf(),lastIndexOf(),substring(int x),substring(int x , int y)方法 StringBuffer
8.
【C / C++】const int *,int * const,int const *,int const * const 的區分技巧
9.
int
10.
int,long,還有mysql的int
更多相關文章...
•
MySQL INT、TINYINT、SMALLINT、MEDIUMINT、BIGINT(整數類型)
-
MySQL教程
•
C# 不安全代碼
-
C#教程
•
Java 8 Stream 教程
•
委託模式
相關標籤/搜索
int
c++int
ptr
a1
tensor&ndarray&int
str&int&bool
0
分享到微博
分享到微信
分享到QQ
每日一句
每一个你不满意的现在,都有一个你没有努力的曾经。
最新文章
1.
1.2 Illustrator多文檔的幾種排列方式
2.
5.16--java數據類型轉換及雜記
3.
性能指標
4.
(1.2)工廠模式之工廠方法模式
5.
Java記錄 -42- Java Collection
6.
Java記錄 -42- Java Collection
7.
github使用
8.
Android學習筆記(五十):聲明、請求和檢查許可
9.
20180626
10.
服務擴容可能引入的負面問題及解決方法
本站公眾號
歡迎關注本站公眾號,獲取更多信息
相關文章
1.
指針和引用(int*、int&、int*&、int&*、int**)
2.
指針和引用---int*、int&、int*&、int&*、int**
3.
int const*與int * const
4.
int indexs=(int)(_v+0.5);
5.
void (*f(int, void (*)(int)))(int) 函數解析
6.
簡化void(*signal(int signum, void(*handler)(int)))(int)
7.
String的indexOf(),lastIndexOf(),substring(int x),substring(int x , int y)方法 StringBuffer
8.
【C / C++】const int *,int * const,int const *,int const * const 的區分技巧
9.
int
10.
int,long,還有mysql的int
>>更多相關文章<<