home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ctutor1.zip / INTRO.TXT < prev    next >
Text File  |  1989-11-10  |  9KB  |  234 lines

  1.  
  2.  
  3.  
  4.  
  5.                                Introduction to the C Tutorial
  6.  
  7.  
  8.  
  9. C IS USUALLY FIRST
  10. ____________________________________________________________
  11.  
  12. The programming language C was originally developed by Dennis
  13. Ritchie of Bell Laboratories and was designed to run on a
  14. PDP-11 with a UNIX operating system.  Although it was
  15. originally intended to run under UNIX, there has been a great
  16. interest in running it under the MS-DOS operating system on
  17. the IBM PC and compatibles.  It is an excellent language for
  18. this environment because of the simplicity of expression, the
  19. compactness of the code, and the wide range of applicability. 
  20. Also, due to the simplicity and ease of writing a C compiler,
  21. it is usually the first high level language available on any
  22. new computer, including microcomputers, minicomputers, and
  23. mainframes.
  24.  
  25. C is not a good beginning language because it is somewhat
  26. cryptic in nature.  It allows the programmer a wide range of
  27. operations from high level down to a very low level,
  28. approaching the level of assembly language.  There seems to
  29. be no limit to the flexibility available.  One experienced C
  30. programmer made the statement, "You can program anything in
  31. C", and the statement is well supported by my own experience
  32. with the language.  Along with the resulting freedom however,
  33. you take on a great deal of responsibility because it is very
  34. easy to write a program that destroys itself due to the silly
  35. little errors that a good Pascal compiler will flag and call
  36. a fatal error.  In C, you are very much on your own as you
  37. will soon find.
  38.  
  39.  
  40.  
  41. I ASSUME YOU KNOW A LITTLE PROGRAMMING
  42. ____________________________________________________________
  43.  
  44. Since C is not a beginners language, I will assume you are not
  45. a beginning programmer, and I will not attempt to bore you by
  46. defining a constant and a variable.  You will be expected to
  47. know these basic concepts.  You will, however, be expected to
  48. know nothing of the C programming language.  I will begin with
  49. the most basic concepts of C and take you up to the highest
  50. level of C programming including the usually intimidating
  51. concepts of pointers, structures, and dynamic allocation.  To
  52. fully understand these concepts, it will take a good bit of
  53. time and work on your part because they not particularly easy
  54. to grasp, but they are very powerful tools.  Enough said about
  55. that, you will see their power when we get there, just don't
  56. allow yourself to worry about them yet.
  57.  
  58.                                                      Page I-1
  59.  
  60.                                Introduction to the C Tutorial
  61.  
  62. Programming in C is a tremendous asset in those areas where
  63. you may want to use Assembly Language but would rather keep
  64. it a "simple to write" and "easy to maintain" program.  It has
  65. been said that a program written in C will pay a premium of
  66. a 20 to 50% increase in runtime because no high level language
  67. is as compact or as fast as Assembly Language.  However, the
  68. time saved in coding can be tremendous, making it the most
  69. desirable language for many programming chores.  In addition,
  70. since most programs spend 90 percent of their operating time
  71. in only 10 percent or less of the code, it is possible to
  72. write a program in C, then rewrite a small portion of the code
  73. in Assembly Language and approach the execution speed of the
  74. same program if it were written entirely in Assembly Language.
  75.  
  76. Even though the C language enjoys a good record when programs
  77. are transported from one implementation to another, there are
  78. differences in compilers as you will find anytime you try to
  79. use another compiler.  Most of the differences become apparent
  80. when you use nonstandard extensions such as calls to the DOS
  81. BIOS when using MS-DOS, but even these differences can be
  82. minimized by careful choice of programming means.  
  83.  
  84. Throughout this tutorial, every attempt will be made to
  85. indicate to you what constructs are available in every C
  86. compiler because they are part of the accepted standard of
  87. programming practice.        
  88.  
  89.  
  90.  
  91. WHAT IS THE ANSI-C STANDARD?
  92. ____________________________________________________________
  93.  
  94. When it became evident that the C programming language was
  95. becoming a very popular programming language available on a
  96. wide range of computers, a group of concerned individuals met
  97. to propose a standard set of rules for the use of the C
  98. programming language.  The group represented all sectors of
  99. the software industry and after many meetings, and many
  100. preliminary drafts, they finally wrote an acceptable standard
  101. for the C language.  By the time you read this, it should be
  102. accepted by the American National Standards Institute (ANSI),
  103. and by the International Standards Organization (ISO).  It is
  104. not forced upon any group or user, but since it is so widely
  105. accepted, it would be economical suicide for any compiler
  106. writer to refuse to conform to the standard.
  107.  
  108.  
  109.  
  110. YOU MAY NEED A LITTLE HELP
  111. ____________________________________________________________
  112.  
  113. Modern C compilers are very capable systems, but due to the
  114. tremendous versatility of a C compiler, it could be very
  115. difficult for you to learn how to use it effectively.  If you
  116.  
  117.                                                      Page I-2
  118.  
  119.                                Introduction to the C Tutorial
  120.  
  121. are a complete novice to programming, you will probably find
  122. the installation instructions somewhat confusing.  You may be
  123. able to find a colleague or friend that is knowledgeable about
  124. computers to aid you in setting up your compiler for use. 
  125.  
  126. This tutorial cannot cover all aspects of programming in C,
  127. simply because there is too much to cover, but it will
  128. instruct you in all you need for the majority of your
  129. programming in C.  You will receive instruction in all of the
  130. programming constructs in C, but what must be omitted are
  131. methods of programming since these can only be learned by
  132. experience.  More importantly, it will teach you the
  133. vocabulary of C so that you can go on to more advanced
  134. techniques using the programming language C.  A diligent
  135. effort on your part to study the material presented in this
  136. tutorial will result in a solid base of knowledge of the C
  137. programming language.  You will then be able to intelligently
  138. read technical articles or other textbooks on C and greatly
  139. expand your knowledge of this modern and very popular
  140. programming language.
  141.  
  142.  
  143.  
  144. HOW TO USE THIS TUTORIAL
  145. ____________________________________________________________
  146.  
  147. This tutorial is written in such a way that the student should
  148. sit before his computer and study each example program by
  149. displaying it on the monitor and reading the text which
  150. corresponds to that program.  Following his study of each
  151. program, he should then compile and execute it and observe the
  152. results of execution with his compiler.  This enables the
  153. student to gain experience using his compiler while he is
  154. learning the C programming language.  It is strongly
  155. recommended that the student study each example program in the
  156. given sequence then write the programs suggested at the end
  157. of each chapter in order to gain experience in writing C
  158. programs.
  159.  
  160.  
  161.  
  162. THIS IS WRITTEN PRIMARILY FOR MS-DOS
  163. ____________________________________________________________
  164.  
  165. This tutorial is written primarily for use on an IBM-PC or
  166. compatible computer but can be used with any ANSI standard
  167. compiler since it conforms so closely to the ANSI standard. 
  168. In fact, a computer is not even required to study this
  169. material since the result of execution of each example program
  170. is given in comments at the end of each program.
  171.  
  172.  
  173.  
  174.  
  175.  
  176.                                                      Page I-3
  177.  
  178.                                Introduction to the C Tutorial
  179.  
  180. RECOMMENDED READING AND REFERENCE MATERIAL
  181. ____________________________________________________________
  182.  
  183. "The C Programming Language - Second Edition",
  184. Brian W. Kernigan & Dennis M. Ritchie, Prentiss-Hall, 1988
  185.  
  186. This is the definitive text of the C programming language
  187. and is required reading for every serious C programmer. 
  188. Although the first edition was terse and difficult to
  189. read, this edition is easier to read and extremely useful
  190. as both a learning resource and a reference guide.
  191.  
  192.  
  193. "C Programming Guide - 3rd Edition",
  194. Jack Purdum, Que Corporation, 1988
  195.  
  196. This book is written for the beginner in C.  It is very
  197. clearly written and makes no assumptions of any prior C
  198. experience.
  199.  
  200.  
  201.  
  202. A SPECIAL NOTE FOR THE SHAREWARE VERSION
  203. ____________________________________________________________
  204.  
  205. It is impossible to include the graphics diagrams in chapters
  206. 8 and 12 in a pure ASCII text.  They are therefore omitted
  207. from this version of the tutorial.  If you need these dia-
  208. grams, they can be purchased directly from Coronado Enter-
  209. prises along with your registration.  See the READ.ME file on
  210. either diskette for more information.
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.                                                      Page I-4
  234.