I have a few questions about pointers.
First, is it correct to do this :
Pointer pMypointer[10] 'Just an array of pointer
If so, can i initialize this pointer like this ? :
pMypointer=NULL ' I think this does not work as I would expect it to. ???
So would this do the job ?
If so, is it the proper way to do that ?
For temp=0 to 9
pMypointer[temp]=NULL
next temp
Thanks.
If I remember correctly (and that is a bit of a reach)
Pointer mypointer[10] declares an array of 10 pointers - an address in the initialized stack area is assigned to the pointer.
mypointer=Null; sets the address of the array of pointers to null - not very useful.
The following sets the contents of each element of mypointer to Null.
For temp=0 to 9
pMypointer[temp]=NULL
next temp
Hi Larry!
Quotemypointer=Null; sets the address of the array of pointers to null - not very useful.
Not very useful indeed as it only initializes the first pointer of the array.
I asked the question because i noticed that pointers are not always initialized after their creation.
So in case i defined an array of pointers just like the example above,
i thought that i should initialize all of them to prevent unexpected results.
Thanks again.
I think that is correct - when a pointer is created it inherits the trash that just happens to
be at the assigned memory location - that is why you should always initialize pointers.
I initialize all vars just to be safe.
You can get some strange results if you do not.