|
-
May 25th, 1999, 08:27 AM
#1
Pointer Question
Here is a fairly rudimentary pointer question:
If I declare a pointer and set it to the address of
a double variable, and that double goes out of scope,
can I be certain that I will always be able to dereference
the variable pointed to? I am trying to initialize an array of pointers
using a for loop...
here's a simple example:
double *values[10]
for (int i=0; i < 10; i++)
{
double d = i*5;
values[i] = &d;
}
can I now be SURE that the memory pointed to always contains the
data that I need? If not, is there a better way to do this? The reason
I ask is that I do not know of a dynamic array of double values, so I want
to do it with CPtrArray.
Jon
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|