Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


global 2d dynamic arrays

This topic is 6082 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, i'm a newbie so forgive me for asking a basic question. I have a dynamic 2d array that is created after reading in a file to decide how big the array will be. its basically an array to hold different words. the first number being the word and the second number being 80 to have plenty of room for the letters. My problem is that the way i have made the array, well it won't let me access it from another function. To best describe this i will show u some code. char **szLine; this line near start of program. loadfile() ..... char **szLine = new char*[num_words]; for(int n = 0;n I call loadfile from main. its a win32 console program. After this all happens it comes back to main and i call game(); In game() the szLine[][] does not exist and my program crashes. "extern" will not work for me and I can't find anywhere on the messages boards here that helps me. Can someone help me make szLine global, or give me hints and suggestions on what i could try or learn. I would prefer to stick with C cause it is more clearer than C++ to me. Thank you for your time and help werdy666 [edited by - werdy666 on April 18, 2002 6:58:37 AM] [Edit: Don't use 'i' as an index value outside source boxes. The board interprets it as italics.] [edited by - Oluseyi on April 18, 2002 7:04:17 AM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!