Re: [Dev-C++] A problem about the pointer.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: A. K. <kli...@ad...> - 2004-06-15 08:59:42
|
Bruce jjs wrote:
> int *p;
>
> void Func(void)
> {
> int number;
>
> number = 11;
> p = &number;
> }
You assign a new address to that pointer, not a new value, and that new
address happens to contain "11" but it resides on the stack of course.
You should do
*p = number;
Then it will work as expected
Alex
|