C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-11-2009, 02:09 PM   #1
Registered User
 
Join Date: Oct 2009
Posts: 1
2D array, size unknown at compile time

Hey all. I'm hoping you can help with an array problem.

I need to create a 2D array with size decided by the user during execution. After its size has been chosen it will not alter during execution of the program.

How would I go about coding that up in a sensible way? Or, should I just approach it a different way?

Thanks
gah_ribaldi is offline   Reply With Quote
Old 10-11-2009, 03:28 PM   #2
Registered User
 
C_ntua's Avatar
 
Join Date: Jun 2008
Posts: 1,134
Doesnt this work?
Code:
x = getX(); //get from user
y= getY();
Object[,]  a = new Object[x,y];
C_ntua is offline   Reply With Quote
Reply

Tags
array, dynamic memory

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Allocating an array of unknown size? scarlet00014 C Programming 2 09-27-2008 09:53 AM
Sending an email in C program Moony C Programming 28 10-19-2006 10:42 AM
Class Template Trouble pliang C++ Programming 4 04-21-2005 04:15 AM
Type and nontype parameters w/overloading Mr_LJ C++ Programming 3 01-02-2004 01:01 AM
Something I'd like to share with all of you: simple frustum culling Silvercord Game Programming 11 03-25-2003 05:13 PM


All times are GMT -6. The time now is 09:22 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22