pointer problems :(

Started by
15 comments, last by dyerseve 18 years, 5 months ago
Sorry for triple posting, but my arrows wont show:

std::vector(ARROR_TO_THE_LEFT)Image*(ARROR_TO_THE_RIGHT) m_Images;
Advertisement
Quote:Original post by Anonymous Poster
Quote:Original post by ErUs
i just realised something silly :(

-
word * tptr = new word [ words[curword].wordsbefore ];
-

i dont want to be allocating new memory :( i want to point to the words allready in the memory :(

what is the defualt type for a pointer? UINT?


That made no sense what-so-ever. A pointer can be of any type, why UINT? UINT is an unsigned int, which isnt a pointer unless you make it UINT*.


on intel32 machines a pointer is usually 32 bits and so are ints...

but it doesnt make much sense to say
int i;
i = (int)&someObject
doSomeThingWithObectPtr( (Object*)i );

just declare a pointer

word *wordptr;

and set it to the address you want

wordptr = &some_word; wordptr = name_of_word_array;

If you want to have an array of pointers, then you simply need the void** pointer type...
lol. im gonna stop with all the unsafe-ness and re-write with the stl :)
-www.freewebs.com/tm1rbrt -> check out my gameboy emulator ( worklog updated regularly )
Could you explain exactly what it is you want to do? Do you want to work with a list of phrases, or something different? Currently, your code looks like you're making some kind of tree. Is this the effect you want? A little more elaborate description wold help.
:stylin: "Make games, not war.""...if you're doing this to learn then just study a modern C++ compiler's implementation." -snk_kid
Do you mean something like this:

TYPE** p = new TYPE* [NUMBER_OF_ELEMENTS];

p[x] = &a
...
delete[] p;

?
Quote:Original post by ErUs
lol. im gonna stop with all the unsafe-ness and re-write with the stl :)



Thats always a good idea.

This topic is closed to new replies.

Advertisement