Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

小弟碰到了一些麻煩

0 views
Skip to first unread message

Vision

unread,
May 24, 2003, 1:35:03 PM5/24/03
to
小弟碰到了一些麻煩:
char x[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08};
int *v1 = &x[4],**v2 = &v1,a = **v2;
……
請問在linux,x86平台下,a = ? (能加上說明更好)


E-mail:lm...@seed.net.tw
一定當面感謝

coco

unread,
May 24, 2003, 11:19:53 PM5/24/03
to
Vision <lm...@seed.net.tw> wrote in message news:<3ECFAD4...@seed.net.tw>...

> 小弟碰到了一些麻煩:
> char x[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08};
> int *v1 = &x[4],**v2 = &v1,a = **v2;
> ……
> 請問在linux,x86平台下,a = ? (能加上說明更好)
>
編譯器應不會過,因為
int *v1 = &x[4]....
&x[4] 不是 int * 型態!

程式改成型態一致:
int x[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08};


int *v1 = &x[4],**v2 = &v1,a = **v2;

結果 a=0x05,因為 **v2==x[4]

關心 SARS 疫情,你投完票了嗎?
http://ehome.hifly.to/showthread.php?s=&threadid=679

0 new messages