home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18718 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  694 b 

  1. Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!princeton!mccc!pjh
  2. From: pjh@mccc.edu (P. J. Holsberg)
  3. Newsgroups: comp.lang.c
  4. Subject: argv[] as a general purpose 2D array
  5. Message-ID: <BzKoLn.8BL@mccc.edu>
  6. Date: 20 Dec 92 19:24:57 GMT
  7. Organization: The College on the Other Side of U. S. 1
  8. Lines: 12
  9.  
  10. Exam question asked that if the name of the file was not typed on the
  11. command line, the user should be prompted for it.  Most set up a char
  12. array to hold the name of the file, and strcpy'd to it from argv[1] if
  13. the name was in argv[1].
  14.  
  15. One student decided to save some memory space and scanf'd the prompted
  16. name directly to argv[1]!
  17.  
  18. Are there any problems to that approach??
  19.  
  20. Thanks,
  21. Pete
  22.