home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12260 < prev    next >
Encoding:
Internet Message Format  |  1992-08-12  |  1.6 KB

  1. Xref: sparky comp.lang.c:12260 comp.programming:2293
  2. Newsgroups: comp.lang.c,comp.programming
  3. Path: sparky!uunet!mcsun!sun4nl!alchemy!matthys
  4. From: matthys@cs.ruu.nl (Matthys Kuiper)
  5. Subject: Re: A LITTLE BRAINTEASER...
  6. Message-ID: <1992Aug13.072329.27685@cs.ruu.nl>
  7. Date: Thu, 13 Aug 1992 07:23:29 GMT
  8. References: <aet.713608023@munagin> <1992Aug12.103013.4999@cs.ruu.nl> <17063@ulysses.att.com>
  9. Organization: Utrecht University, Dept. of Computer Science
  10. Lines: 25
  11.  
  12. In <17063@ulysses.att.com> kpv@ulysses.att.com (Phong Vo) writes:
  13.  
  14. >In article <1992Aug12.103013.4999@cs.ruu.nl> matthys@cs.ruu.nl (Matthys Kuiper) writes:
  15. >>In <aet.713608023@munagin> aet@mullian.ee.mu.OZ.AU (bert thompson) writes:
  16. >>>is it possible to write a program that reverse the order of input lines
  17. >>>without using data structures.
  18. >>>the rules of the game are you can use anything but data structures, or more
  19. >>>specifically you cannot use the heap.
  20. >>
  21. >>Below is my solution in Pascal. The translation of this program
  22. >>into C is horrible to read and not included in this posting.
  23. ><code deleted>
  24. >
  25. >The code probably isn't right either since functions such as readln() may very well
  26. >does some form of dynamic memory allocation to store the lines.
  27. No, readln(input) just skips till the end of a line; it does not have to store any
  28. of the skipped characters.
  29. To solve the problem you must assume something
  30. about the heap usage of basic I/O routines. I assume that reading and/or skipping
  31. basic characters does not use the heap.
  32.  
  33. -- 
  34. Matthijs F. Kuiper   Department of Computer Science
  35. kuiper@cs.ruu.nl     Padualaan 14/ Postbox 80.089 
  36.              3508 TB Utrecht/ The Netherlands
  37.