Article View: comp.std.c
Article #3358Re: Declare array size at run time not compile time???Help??
From: Christopher R. Volpe
Date: Mon, 16 Oct 1995 22:56
Date: Mon, 16 Oct 1995 22:56
31 lines
1956 bytes
1956 bytes
In article <coder.5.0048A737@neosoft.com>, coder@neosoft.com (Coder) writes: >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. Wrong Newsgroup. Look up "malloc" in one of your books, then read the comp.lang.c FAQ list, then, if necessary, post the question to either comp.lang.c or, better yet, comp.lang.c.moderated. Comp.std.c is for discussing the ANSI/ISO C Standard and its implications on the conformance of programs and compilers. The comp.lang.c FAQ is posted once a month to comp.lang.c and news.answers. You can also retrieve it via FTP from rtfm.mit.edu. Followups redirected to comp.lang.c.moderated. -- Chris Volpe Phone: (518) 387-7766 (Dial Comm 8*833 GE Corporate R&D Fax: (518) 387-6560 PO Box 8, Schenectady, NY 12301 Email: volpecr@crd.ge.com
Technical Details
Message-ID:
<45unus$8l3@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<coder.5.0048A737@neosoft.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: volpe@bart.crd.ge.com (Christopher R. Volpe) Newsgroups: comp.std.c,comp.lang.c.moderated Subject: Re: Declare array size at run time not compile time???Help?? Followup-To: comp.lang.c.moderated Date: 16 Oct 1995 17:56:28 -0500 Organization: GE Corporate Research & Development Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <45unus$8l3@solutions.solon.com> References: <coder.5.0048A737@neosoft.com> Reply-To: volpe@ausable.crd.ge.com NNTP-Posting-Host: solutions.solon.com