home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!olivea!apple!netcomsv!mama!netcomsv!ulogic!hartman
- From: hartman@ulogic.UUCP (Richard M. Hartman)
- Newsgroups: comp.lang.c
- Subject: Re: Arrays with variable dimensions?
- Message-ID: <788@ulogic.UUCP>
- Date: 30 Dec 92 01:28:06 GMT
- References: <1992Dec26.220736.22177@news.ysu.edu>
- Organization: negligable
- Lines: 24
-
- You got more details than "vary according to user input"?
-
- Off the top of my head (w/ no safety checks & uncompiled)
- a program that creates and fills an array where each value
- in the array is 2 times the index value (no output of course,
- but who's counting?):
-
- main()
- {
- int sz, i;
- int *a;
- printf("Enter array size:\n");
- sscanf("%d", &sz);
- a = (int *) malloc(sz * sizeof(int));
- for (i=0; i<sz; i++)
- a[i] = i*2;
- }
-
-
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- Blasting, bursting, billowing forth with |
- the power of ten billion butterfly sneezes, | -Richard Hartman
- Man, with his flaming fire, | hartman@uLogic.COM
- has conquered the wayword breezes. |
-