Click here to Skip to main content
15,906,708 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionFairly basic pointer/array question Pin
MALDATA21-Aug-07 16:32
MALDATA21-Aug-07 16:32 
AnswerRe: Fairly basic pointer/array question Pin
cp987621-Aug-07 16:54
cp987621-Aug-07 16:54 
GeneralRe: Fairly basic pointer/array question Pin
MALDATA21-Aug-07 18:17
MALDATA21-Aug-07 18:17 
GeneralRe: Fairly basic pointer/array question Pin
cp987621-Aug-07 19:13
cp987621-Aug-07 19:13 
GeneralRe: Fairly basic pointer/array question Pin
Nelek21-Aug-07 20:14
protectorNelek21-Aug-07 20:14 
GeneralRe: Fairly basic pointer/array question Pin
cp987621-Aug-07 21:12
cp987621-Aug-07 21:12 
GeneralRe: Fairly basic pointer/array question Pin
Nelek22-Aug-07 1:20
protectorNelek22-Aug-07 1:20 
GeneralRe: Fairly basic pointer/array question Pin
MALDATA22-Aug-07 4:18
MALDATA22-Aug-07 4:18 
OK, I changed it so that the out array is now allocated from the heap
<br />
node* out = new node*[3];<br />

And now the output looks something like this:
7
3
9
The array contains...
7
garbage
garbage

So it looks like you solved the problem, and that makes sense to me. It gets the array back and can dereference the first element of the array, but I'm apparently not iterating the pointer properly to get to the next elements. As it is, I use the pointer, myArray, plus sizeof(node*) to get to the next element of the array.
<br />
myArray+=sizeof(node*);<br />

Should it be something other than node*? If so, what and why? It's an array of pointers to nodes, so shouldn't the next one just be sizeof(node*) away from the first?

Thanks for the help!
GeneralRe: Fairly basic pointer/array question Pin
Nelek22-Aug-07 4:55
protectorNelek22-Aug-07 4:55 
GeneralRe: Fairly basic pointer/array question Pin
MALDATA22-Aug-07 8:39
MALDATA22-Aug-07 8:39 
GeneralRe: Fairly basic pointer/array question Pin
Nelek22-Aug-07 20:01
protectorNelek22-Aug-07 20:01 
GeneralRe: Fairly basic pointer/array question Pin
cp987622-Aug-07 20:40
cp987622-Aug-07 20:40 
QuestionCreateDirectoryA can not be resolved Pin
George_George21-Aug-07 16:27
George_George21-Aug-07 16:27 
AnswerRe: CreateDirectoryA can not be resolved [modified] Pin
Paresh Chitte21-Aug-07 18:36
Paresh Chitte21-Aug-07 18:36 
GeneralRe: CreateDirectoryA can not be resolved Pin
George_George21-Aug-07 20:51
George_George21-Aug-07 20:51 
GeneralRe: CreateDirectoryA can not be resolved Pin
Paresh Chitte21-Aug-07 22:05
Paresh Chitte21-Aug-07 22:05 
GeneralRe: CreateDirectoryA can not be resolved Pin
George_George21-Aug-07 22:23
George_George21-Aug-07 22:23 
AnswerRe: CreateDirectoryA can not be resolved Pin
David Crow22-Aug-07 2:30
David Crow22-Aug-07 2:30 
GeneralRe: CreateDirectoryA can not be resolved Pin
George_George22-Aug-07 3:16
George_George22-Aug-07 3:16 
QuestionEncoder Pin
celllllllll21-Aug-07 12:08
celllllllll21-Aug-07 12:08 
QuestionRe: Encoder Pin
celllllllll21-Aug-07 12:27
celllllllll21-Aug-07 12:27 
AnswerRe: Encoder Pin
cp987621-Aug-07 13:29
cp987621-Aug-07 13:29 
AnswerRe: Encoder Pin
El Corazon21-Aug-07 13:48
El Corazon21-Aug-07 13:48 
GeneralRe: Encoder Pin
celllllllll21-Aug-07 14:33
celllllllll21-Aug-07 14:33 
GeneralRe: Encoder Pin
El Corazon21-Aug-07 15:03
El Corazon21-Aug-07 15:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.