home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!world!dirsolns
- From: dirsolns@world.std.com (Bernard Farrell)
- Subject: Re: Arrays with variable dimensions?
- Message-ID: <C04tnH.LCH@world.std.com>
- Organization: Directed Solutions Group
- X-Newsreader: Tin 1.1 PL3
- References: <1992Dec31.104644.9299@druid.uucp>
- Date: Thu, 31 Dec 1992 16:26:04 GMT
- Lines: 29
-
- darcy@druid.uucp (D'Arcy J.M. Cain) writes:
- : dirsolns@world.std.com (Bernard Farrell) writes:
- : >ah017@yfn.ysu.edu (John B. Lee) writes:
- : >: Is it possible to create an array that would change size according
- : >: to user input?
- : >float fl_arr[] = NULL; /* This is actually a float * -- no space */
- :
- : You didn't even try this did you? This actually does assign space to an
- : array. I don't know what your compiler does with the "= NULL" but assuming
- : it even accepts it (mine doesn't) it certainly doesn't do what you think it
- : does. If you want a float * why didn't you just declare that:
- :
- : float *fl_arr = NULL;
- :
-
- D'Arcy,
-
- First of all, the approach I've outlined works for me on a number
- of machines. Second, ff I'm going to treat the pointer as an array,
- I'd rather make this OBVIOUS in the declaration, even if the variable
- name does help.
-
- I'd be interested to know the kind of machine you compiled this
- on, the ones I've done this before on may not be very ANSI compliant.
- --
- |----------------------------------------------------------|
- | Bernard Farrell | Directed Solutions Group |
- |----------------------------------------------------------|
- | dirsolns@world.std.com | (617) 429-2306 |
-