Article View: comp.std.c
Article #4232Re: Declare array size at run time not compile time???Help??
From: Paul D. Eccles
Date: Mon, 16 Oct 1995 18:09
Date: Mon, 16 Oct 1995 18:09
17 lines
1163 bytes
1163 bytes
Coder (coder@neosoft.com) wrote: : I want to use an array to create a 2d matrix and fill it with random data in a : loop. I want to give the user the option of changing the size of the array : and looping that new one, filling it with random data. Then I will compare : the output of the two. But I don't know what size the user will want the : array to be. : int matrix[13][45] first time : int matrix[2][10] second time : int matrix[40][40] third time : how can I change the size while the program is running. Using visual c++ 1.52 : I try to say matrix[x][y] but I need constants inside of the [ ] and I don't : know of another approach, my books are not very helpful. Ever hear of dynamic allocation. Check malloc.
Technical Details
Message-ID:
<45u74t$t3c@gozer.inri.com>Path:
arc1-ca.pugleaf.net!gozer.inri.com!zymurgy!pdeReferences:
<coder.5.0048A737@neosoft.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!gozer.inri.com!zymurgy!pde From: pde@zymurgy (Paul D. Eccles) Newsgroups: comp.std.c Subject: Re: Declare array size at run time not compile time???Help?? Date: 16 Oct 1995 18:09:33 GMT Organization: Inter-National Research Institute Message-ID: <45u74t$t3c@gozer.inri.com> References: <coder.5.0048A737@neosoft.com> NNTP-Posting-Host: zymurgy.sd.inri.com X-Newsreader: TIN [version 1.2 PL2]