home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / software / 4960 < prev    next >
Encoding:
Text File  |  1992-12-14  |  1.2 KB  |  44 lines

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!caen!uvaarpa!concert!seq!herbst
  3. From: herbst@seq.uncwil.edu (R.T. Herbst)
  4. Subject: C Code Layout
  5. Message-ID: <1992Dec15.023235.17090@seq.uncwil.edu>
  6. Keywords: c Code
  7. Organization: Univ. of North Carolina @ Wilmington
  8. Date: Tue, 15 Dec 1992 02:32:35 GMT
  9. Lines: 33
  10.  
  11.  
  12. Here is a way to have your code and eat it too.
  13. Each comment suggesct that you escape the editor and look 
  14. at a file the can be as large as you please.  The files
  15. should be in the same directory as the code that is being 
  16. tested or written. The code is not cluttered with long comments.
  17. Imagine a screen of comments followed by a single instruction that is
  18. followed by 20 lines of comments. 
  19.  
  20. /* Document 
  21. * :! vi doc.file
  22. */
  23. #include <stdio.h>
  24. main()
  25. {
  26. /* Declare internal variables.*/
  27.     int c;
  28.     while(( c = getchar()) != '\n') /* :! vi comment1*/
  29.     ;
  30. }
  31.  
  32. cat doc.file
  33. This program is intended to read characters into the integer c
  34. until a newline is encountered.
  35.  
  36. cat comment1
  37.  
  38. This often used construct will read characters from the standard
  39. input file until a nelwline is encountered. It is also very 
  40. useful in removing newlines left in the standard input file as a result
  41. of executing scanf.
  42. herbst@seq.uncwil.edu
  43.  
  44.