simple c++ question (pointers)
im trying to take each word untill end of file and put it in 1 element of a vector...
i know that char *words[1000] are pointers, so, when i want to read in the words, i need to somehow create a new space for each new word, right now it is just overriding the previous word and so the words vector points to the same word... here is a simple code example... Code:
int wordSze =0; |
"i need to somehow create a new space for each new word,"
You pick up the new memory with the malloc function. You store the address of the memory provided by malloc into the array element. ___________________________________ Be prepared. Create a LifeBoat CD. http://users.rcn.com/srstites/LifeBo...home.page.html Steve Stites |
All times are GMT -5. The time now is 07:50 AM. |