[問題] 能將指標拆成整數儲存嗎?
unsigned int * p;
unsigned int x,y;
用sizeof看 p : 8 bytes
x : 4 bytes
y : 4 bytes
能夠把p拆成兩半存進x,y
之後在把x,y組合成p嗎?
===============================================
typedef struct{
unsigned int x;
unsigned int y;
}UI;
typedef union{
unsigned int* p;
UI i;
}MYTYPE;
這樣還蠻方便的@@
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.129.35.39
→
08/31 00:44, , 1F
08/31 00:44, 1F
→
08/31 00:46, , 2F
08/31 00:46, 2F
※ 編輯: deepking 來自: 220.129.34.102 (08/31 11:18)
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 5 篇):