Saturday, June 27, 2015

C Overview


  • History
    • Dennis Richie, invented it, to write the Unix with it -> 1970
    • Previously Unix was written by assembly -> Bad portability :(
      • Rewrite Unix again for each new processor
    • ANSI (American National Standardization Institute), released the first C standard in 1989 ( C89 )
    • Amendment 1 was added to C89 in 1995
    • C89 with Amendment 1 is the base of C++
    • C89 with Amendment 1 is called the C Subset of C++
    • C99 was released by ANSI in 1999
      • Nearly the same as C89  + some added features (Such as: Variable Length Arrays and strict pointer qualifier)

  • Middle Level Language
    • High level features:
      • C is like the High Level Language in the following features:
        • Portable (easy to adapt the program written for a platform to another platform)
        • Supports DataTypes
          • A datatype defines
            • A set of values that the variable can store
            • A set of operations that can be performed on that variable
      • C is unlike the High Level Languages in the following features:
        • C does not support Run-Time Error Checking, like "array index out of bound"
        • C is a Weakly typed language
          • Implicit casting is allowed
          • Implicit casting happens for arguments that does not match the parameter type.
        • C has few keywords:
          • 32 Keyword in C89
          • 5 more Keywords in C99
          • BASIC (a high level language) defined 100 keywords
    • Low Level Features:
      • Manipulation of Bits, Bytes and Addresses
C key words,  from "The Complete C Reference - 4th Edition"
  • C is a Structured Language
    • The code consists of component blocks (functions - while - if - ...etc )
    • goto usage is either forbidden or discouraged
    • Assembly is not a structured language, cause the code contains jumps and branches -> Spaghetti code!

  • C is a programmer language
    • Unlike BASIC language, which is developed for non-programmers to solve simple problems.

  • Compiler Vs Interpreter
    • Interpreter parses one line of code at a time, execute it.
    • Compiler parses the whole program, generates machine code, that is executed.
    • Interpreter parses the code line each time it is being executed
    • Compiler parses the code lines only once.
    • Java is designed for interpretation.
    • C is designed for compilation (However we can make C interpreters, however will not best utilize C)

No comments:

Post a Comment