N**********d 发帖数: 9292 | 1 例如
char* cptr="aaaaaa";
char c[]="bbbbbb";
怎么知道他们保存在什么地方? |
p****s 发帖数: 32405 | 2 你想把cptr和c的地址打印出来?
【在 N**********d 的大作中提到】 : 例如 : char* cptr="aaaaaa"; : char c[]="bbbbbb"; : 怎么知道他们保存在什么地方?
|
N**********d 发帖数: 9292 | 3 就是问问怎么能知道是在数据区还是栈区之类的
【在 p****s 的大作中提到】 : 你想把cptr和c的地址打印出来?
|
k****f 发帖数: 3794 | 4 问编译器了
【在 N**********d 的大作中提到】 : 就是问问怎么能知道是在数据区还是栈区之类的
|
P********e 发帖数: 2610 | 5 第一个也是undefined吗?
第二个不是一定stack吗?
【在 k****f 的大作中提到】 : 问编译器了
|
k****f 发帖数: 3794 | 6 如果拿8051/avr单片机编译器,就不一定的
【在 P********e 的大作中提到】 : 第一个也是undefined吗? : 第二个不是一定stack吗?
|
c*****t 发帖数: 1879 | 7
cptr points to a data/text memory location. Trying to modify this
content can result in segmentation fault on Unix. On PC, it might
be allowed to modify it though.
c points to a region on stack. You can modify it without hesitation.
【在 N**********d 的大作中提到】 : 例如 : char* cptr="aaaaaa"; : char c[]="bbbbbb"; : 怎么知道他们保存在什么地方?
|
N**********d 发帖数: 9292 | 8 谢谢了
【在 c*****t 的大作中提到】 : : cptr points to a data/text memory location. Trying to modify this : content can result in segmentation fault on Unix. On PC, it might : be allowed to modify it though. : c points to a region on stack. You can modify it without hesitation.
|
N**********d 发帖数: 9292 | 9 对pc呢?
例如gcc对x86编是什么情况?
【在 k****f 的大作中提到】 : 如果拿8051/avr单片机编译器,就不一定的
|
c********g 发帖数: 449 | 10 c:\>debug compiled.exe
search "aaaaa" you will know where it is |