C programming language l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 15

C Programming Language PowerPoint PPT Presentation


  • 175 Views
  • Uploaded on
  • Presentation posted in: General

C Programming Language. Bill Jensen CS 354 May, 3 rd 2007. Catalyst. In late 1960’s Bell Labs left project on Multics, and soon after he and others began working on the Unix Operating System. Ken Thompson wanted a comfortable computing environment of his own design.

Download Presentation

C Programming Language

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


C programming language l.jpg

C Programming Language

  • Bill Jensen

  • CS 354

  • May, 3rd 2007


Catalyst l.jpg

Catalyst

In late 1960’s Bell Labs left project on Multics, and soon after he and others began working on the Unix Operating System.

  • Ken Thompson wanted a comfortable computing environment of his own design.

  • B programming language was created, based on languages used when creating Multics; especially BCPL.

  • Thompson decided Unix needed a system programming language.


Creation l.jpg

Creation

  • By 1970 Unix had shown promise and Bell Labs acquired the new DEC PDP-11

  • By 1971…We all wanted to create interesting software more easily.

  • B’s problems – 1) Clumsy Character handling 2) Floating point not available on PDP-11 3) Implied overhead with pointers

  • Alterations to B and a new name, NB.


Creation continued l.jpg

Creation - continued

  • NB proved to be insufficient and with further changes was renamed to C.

  • Many changes around 1972-3, but main was introduction of preprocessor.

  • Portability developed as I/O Libraries written by Mike Lesk.

  • 1977 produced changes focused on portability and type safety.

  • 1978 Brian Kernighan and Dennis Ritchie Published The C Programming Language.


Control standardization l.jpg

Control - standardization

  • Portability tests (Interdata 8/32, DEC VAX 11/780) lead to wide spread use during the 1980’s.

  • Compilers became available on most every machine architecture.

  • Wide use, including use on commercial and Government projects lead to establishment of X3J11 committee established by ANSI to produce a standardization of C.


Characteristics l.jpg

Characteristics

  • An Imperative, Procedural programming language.

  • Design based on the implementation of computer processors based upon the von Neumann architecture.

  • Low level access to memory by machine addresses and typed pointers.


Variables types operators l.jpg

Variables, Types & Operators

  • Variables - Must begin with letter followed by any number and combination of letters and digits. (strings are implemented as char arrays)

  • Types – char, int (short, long), float, double

  • shorts, ints – min 16 bits

  • Long – min 32 bits

  • Binary Operators: +, -, *, /, %

  • Logic Operators: >, >=, <, <=, ==, !=, &&, ||, ! (negate)

  • Bitwise: &, |, ^, <<, >>, - (unary)


Assignment expressions l.jpg

Assignment Expressions

  • Assignment: =, +=, -=, *=, /=, &=, ^=, |=, <<=, >>=

  • Most associativity is Left to Right

  • Ex. x = 1 + 2;

  • Ex. y += 4; (y = y + 4;)


Control flow l.jpg

Control Flow

  • If-Else, Else-If, Switch, Loops, GOTO

  • Loops – While, For, Do-while

  • GOTO and Labels – GOTO’s can be useful in error handling in special cases but usually should be avoided

  • Labels – same form as a variable followed by a colon

  • “goto statements should be used rarely, it at all” – Kernighan, Ritchie


Pointers and arrays l.jpg

Pointers and Arrays

  • Pointers contain addresses of variables.

    Ex. int x = 10; // var x has value of 10

    int *ptr; // ptr points to the address of an int

    ptr = &x; // ptr now has value of x (10)

Arrays can be declared normally and as pointer arrays.

Ex. Int array[] // one dimensional

int twoDimArray[][] // two dimensional array

* Pointer arrays are usually faster but harder to understand.


Structures l.jpg

Structures

  • Structures – a collection of one or more variables or any type.

  • Structures are used to help organize complicated data.

    Ex. Struct account {

    char *accountHolder;

    double checkingBalance;

    double savingsBalance;

    }


Conclusion l.jpg

Conclusion

  • Readability – overall easy to read and intuitive. Pointers can make reading code difficult.

  • Simplicity – simple design making c easy to learn and apply.

  • Orthogonality – c is not very restrictive, which allows some creativity and some higher chances of writing bugged code.


Conclusion continued l.jpg

Conclusion - continued

  • Easy to learn basic concepts.

  • Lack simple implementation of object oriented programming can make class OOP tedious.


Primary uses l.jpg

Primary Uses

  • True to its original purpose C is most often used in systems programming.

  • Operating Systems

  • Embedded Systems

  • Intermediate Language for higher-level languages

    * Java

  • Computer Game Programming


Bibliography l.jpg

Bibliography

  • Kernighan, Brian W., and Dennis M. Ritchie. The C Programming Language. New Jersey: Prentice Hall, 1988.

  • Sebesta, Robert W. Concepts of programming languages. Boston: Pearson, 2006.

  • Ritchie, Dennis M. The Development of the C Language*. Murray Hill, NJ: .

  • "C (programming language)

  • ." wikipedia.org. April, 25th 2007.<http://en.wikipedia.org/wiki/C_programing_language>.


  • Login