CSE 100: C Programming - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

CSE 100: C Programming

Description:

... simple grammar Too easy to make trivial mistakes And exceptionally hard to find to them Too easy ... Conditionals (IF) Iterative (WHILE, FOR) Branching ... – PowerPoint PPT presentation

Number of Views:58
Avg rating:3.0/5.0
Slides: 15
Provided by: ZMK
Category:

less

Transcript and Presenter's Notes

Title: CSE 100: C Programming


1
CSE 100 C Programming
  • Partha Dasgupta

rhymes with Martha
2
Recap
  • For Loops
  • While Loops
  • Break and Continue
  • Recursion is bad ?
  • Disagree ?

3
Caeser
  • Friends, Romans, countrymen,
  • lend me your ears
  • I come to bury Caesar,
  • not to praise him.

4
C
  • Friends, Students, Fellow Sufferers,
  • lend me your ears
  • I come to bury C,
  • not to praise it.

5
What is the big deal?
  • C is one of the most popular programming
    languages
  • Other than C
  • C is an object oriented sugar coating of C
  • Sugar cannot hide the underlying tart
  • All programming languages that are better are
    essentially dead
  • We love complexity and we hate to type
  • It is all about power and obfuscation (job
    security too)

6
A bit of history
  • Machine Code
  • Assembly Language
  • A lot of languages, leading to FORTRAN and COBOL
  • A parade of languages that died.
  • Algol
  • APL
  • Snobol
  • Pascal
  • Modula
  • PL/1
  • ADA
  • What lives on is C and C (with Java making
    inroads)
  • Smalltalk
  • Eiffel

7
What is right about C
  • Object Oriented
  • Plethora of dynamic binding features
  • Powerful, cryptic also the reason why its a
    problem language
  • Almost as powerful as assembly
  • Derived from C
  • Not too easy to learn
  • Touted benefits
  • Readable code
  • Highly structures
  • Almost type safe with Standard Template Library
  • Aside How to write code that is not vulnerable
    to attacks on the internet??

8
So what is the problem
  • Lack of a consistent, simple grammar
  • Too easy to make trivial mistakes
  • And exceptionally hard to find to them
  • Too easy (and tempting) to write unreadable code
  • The obfuscated C contest, also C
  • Its like fire, cannot live without it, but it
    really can (and will) burn you
  • Handle with care

9
C Programming
  • C Programming C Programming
  • Program Algorithms Data Structures

10
Algorithms
  • Alice sends Bob to the supermarket
  • How to express
  • Conditionals (IF)
  • Iterative (WHILE, FOR)
  • Branching (GOTO)
  • Recursive
  • Variables Data Structures

11
Data Structures
  • How do you sort your socks?
  • Arrays
  • Structures
  • Linked Lists
  • Trees
  • Hash Tables

12
Grammar Anyone?
  • Expression Grammar
  • expr expr expr
  • expr expr expr
  • expr expr expr
  • expr expr / expr // expr expr -/
    expr
  • expr (expr)
  • expr number
  • expr term / expr
  • expr term
  • term factor - term
  • term factor
  • factor (expr)
  • factor number

13
Eclectic Stuff
  • Can a program understand another program?
  • SURE

14
Eclectic Stuff
  • The halting problem
  • Does a routing halts exist that can decide if a
    program halts?
  • programA (programB)
  • if halts(programB)
  • loop forever
  • else exit
  • Now what happens if we call
  • programA(programA) // funny? or inspiring?
Write a Comment
User Comments (0)
About PowerShow.com