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

Can a pointer simultaneously point to 2 different memory locations ?

3 views
Skip to first unread message

ankus...@gmail.com

unread,
Aug 2, 2006, 8:57:01 AM8/2/06
to
HI,
In a code for simulation, I am using a pointer to C++ struct. At some
point in simulation (after something like 10,000 iterations) the
pointer is behaving wild. In some functions it points to some random
memory location, and further in next step when passed to another
function it points to the desired location. Thus it keeps on switching
this behaviour. Because of this it is skipping some computational steps
on the desired struct variables causing my program to crash.
Can someone suggest a possible cause for this problem.
Thanks
Ankush

Gregory Weston

unread,
Aug 2, 2006, 8:59:15 PM8/2/06
to
In article <1154523421.5...@i3g2000cwc.googlegroups.com>,
"ankus...@gmail.com" <ankus...@gmail.com> wrote:

A pointer is essentially just a number; no more capable of
simultaneously having two values or spontaneously switching between two
values than an int or any other atomic type. I suspect you're not
looking at what you think you're looking at. Like you've got variables
with the same name in nested scopes.

G

--
What I write is what I mean. I request that anyone who decides to respond
please refrain from "disagreeing" with something I didn't write in the first
place.

0 new messages