由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - c或者c++中变量保存在什么地方怎么看呢?
相关主题
请教一个Matlab作曲线颜色的问题为什么需要定义 = 和 copy ctor
Why this associated pointer cannot be deallocated?Excel VBA protection.
请教一个const pointer的问题C++ string类输入数据的问题
C++ deletewhat's wrong with this C++ code?
why int** cannot convert to const int** ?关于在rotated sorted array中查找的问题
C的问题,高手请指点Do the two statements cost the same amount of time?
Javascript: dynamicly enable draggable id?C++: define a reference always reference the same object
How to see the content of a library filetypedef
相关话题的讨论汇总
话题: cptr话题: modify话题: 量保话题: char话题: 中变
进入Programming版参与讨论
1 (共1页)
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
1 (共1页)
进入Programming版参与讨论
相关主题
typedefwhy int** cannot convert to const int** ?
a question about CASTC的问题,高手请指点
C++: How to read until the end of file?Javascript: dynamicly enable draggable id?
帮帮看看这段tree insertionHow to see the content of a library file
请教一个Matlab作曲线颜色的问题为什么需要定义 = 和 copy ctor
Why this associated pointer cannot be deallocated?Excel VBA protection.
请教一个const pointer的问题C++ string类输入数据的问题
C++ deletewhat's wrong with this C++ code?
相关话题的讨论汇总
话题: cptr话题: modify话题: 量保话题: char话题: 中变