home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1995 December / SOFM_Dec1995.bin / pc / dos / gi / ctutor / intro.txt < prev    next >
Text File  |  1995-10-31  |  7KB  |  190 lines

  1.                    Introduction to the Turbo C Tutorial
  2.  
  3.  
  4.              The programming language C, was originally developed by
  5.         Dennis  Ritchie of Bell Laboratories and was designed to run
  6.         on a PDP-11 with a UNIX operating system.   Although it  was
  7.         originally  intended  to run under UNIX,  there has  been  a
  8.         great  interest  in  running it under the  MS-DOS  operating
  9.         system and specifically on the IBM PC and  compatibles.   It
  10.         is an excellent language for this environment because of the
  11.         simplicity of expression,  the compactness of the code,  and
  12.         the wide range of applicability.
  13.  
  14.              It  is  not a good "beginning" language because  it  is
  15.         somewhat cryptic in nature.  It allows the programmer a wide
  16.         range of operations from high level down to a very low level
  17.         approaching the level of assembly language.   There seems to
  18.         be no limit to the flexibility available.  One experienced C
  19.         programmer made the statement,  "You can program anything in
  20.         C", and the statement is well supported by my own experience
  21.         with  the  language.    Along  with  the  resulting  freedom
  22.         however,  you take on a great deal of responsibility because
  23.         it is very easy to write a program that destroys itself  due
  24.         to  the  silly little errors that the Pascal  compiler  will
  25.         flag  and call a fatal error.   In C,  you are very much  on
  26.         your own as you will soon find.
  27.  
  28.              Since C is not a beginners language,  I will assume you
  29.         are  not a beginning programmer,  and I will not attempt  to
  30.         bore you by defining a constant and a variable.  You will be
  31.         expected to know these basic concepts.   You will,  however,
  32.         be  expected to know nothing of the C programming  language.
  33.         I  will begin with the most basic concepts of C and take you
  34.         up  to  the  highest level of C  programming  including  the
  35.         usually intimidating concepts of pointers,  structures,  and
  36.         dynamic allocation.   To fully understand these concepts, it
  37.         will  take a good bit of time and work on your part  because
  38.         they  not  particularly easy to grasp,  but  they  are  very
  39.         powerful tools.   Enough said about that, you will see their
  40.         power when we get there,  just don't allow yourself to worry
  41.         about them yet.
  42.  
  43.              Programming  in C is a tremendous asset in those  areas
  44.         where you may want to use Assembly Language but would rather
  45.         keep it a "simple to write" and "easy to maintain"  program.
  46.         It  has  been said that a program written in C  will  pay  a
  47.         premium  of  a  50 to 100% increase in  runtime  because  no
  48.         language  is  as  compact  or  fast  as  Assembly  Language.
  49.         However, the time saved in coding can be tremendous,  making
  50.         it the most desirable language for many programming  chores.
  51.         In  addition, since most programs spend 90 percent of  their
  52.         operating time in only 10 percent or less of the code, it is
  53.         possible  to  write  a program in C, then  rewrite  a  small
  54.         portion  of the code in Assembly Language and  approach  the
  55.  
  56.  
  57.                                   Page 1
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                    Introduction to the Turbo C Tutorial
  68.  
  69.  
  70.         execution  speed  of  the same program if  it  were  written
  71.         entirely in Assembly Language.
  72.  
  73.              Even  though the C language enjoys a good  record  when
  74.         programs are transported from one implementation to another,
  75.         there  are differences in compilers as you will find anytime
  76.         you  try to use another compiler.   Most of the  differences
  77.         become apparent when you use nonstandard extensions such  as
  78.         calls  to  the DOS BIOS,  but even these differences can  be
  79.         minimized  by careful choice of programming means.  Turbo  C
  80.         follows  the  developing  ANSI standard so  well  that  your
  81.         programs  developed with Turbo C should be very portable  if
  82.         you should decide to use a different ANSI standard compiler.
  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.  Most of those constructs will use the
  88.         generic  name "C", such as in the statement, "writing  to  a
  89.         file is easy in C after you master a few fundamentals."   If
  90.         a  particular  construct  is  a  Borland  extension  to  the
  91.         language, it will be pointed out as such as an indication to
  92.         you that it may not be available on other compilers.
  93.  
  94.              Turbo  C  is a very capable compiler, but  due  to  the
  95.         tremendous  versatility of this compiler, it could  be  very
  96.         difficult  for you to learn how to use it  effectively.   If
  97.         you are a complete novice to programming, you will  probably
  98.         find the installation instructions somewhat confusing.   The
  99.         file on the SOURCE disk named COMPILER.DOC is provided  just
  100.         for  you  since it will take you step by  step  through  the
  101.         installation procedure and even show you how to compile  and
  102.         run  your  first program.  You should print out  a  copy  of
  103.         COMPILER.DOC at this time and use it as an aid to installing
  104.         Turbo C on your system.
  105.  
  106.              This  tutorial cannot cover all aspects of  programming
  107.         in C, simply because there is too much to cover, but it will
  108.         instruct  you  in  all you need for  the  majority  of  your
  109.         programming  in C.  You will receive instruction in  all  of
  110.         the  programming constructs in C, but what must  be  omitted
  111.         are  methods of programming since these can only be  learned
  112.         by  experience.   More importantly, it will  teach  you  the
  113.         vocabulary  of C so that you can go on to the more  advanced
  114.         techniques of using the programming language C.
  115.  
  116.              It  would definitely be to your advantage to study  the
  117.         Turbo C User's Guide at this point to gain experience in how
  118.         to  edit,  compile, and run a C program.   You  should  read
  119.         chapter  2  to  familiarize  yourself  with  the  Integrated
  120.         Environment and learn how to use it, and to learn how to use
  121.  
  122.  
  123.                                   Page 2
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.                    Introduction to the Turbo C Tutorial
  134.  
  135.  
  136.         the  full  screen  editor which is a part  of  the  Turbo  C
  137.         Integrated Environment.
  138.  
  139.              Remember  to read the file COMPILER.DOC To aid  you  in
  140.         compiling your first program.
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.                                   Page 3
  190.