home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 19077 < prev    next >
Encoding:
Text File  |  1992-12-31  |  1.6 KB  |  41 lines

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