05-intro-functions_in_C

05-intro-functions_in_C - Computer Science 136: David R....

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Computer Science 136: David R. Cheriton School of Computer Science Elementary Algorithm Design and Data Abstraction Winter 2012 Lecture 5 An Introduction to C We introduce the C programming language. C is a general purpose programming language developed by Dennis Ritchie in 1969-73, for use in the UNIX operating system. Both C and UNIX are still extremely important now. C exposes the machine architecture and memory model like few other languages and hence is extremely important in our understanding of computer programming. CS 136 Winter 2012 05 Introduction to C 1/35 Intro to C C is often referred to as a System implementation language Brian Kernighan, Dennis Ritchie and others developed the UNIX operating system in the early 1970s, and developed C as its implementation language. UNIX was the first operating system (OS) that made it off mainframes, to minicomputers, and then to microcomputers C is considered a low-level language, especially in its early versions. It allows direct access to the machine, and often reflects the idiosyncrasies of the computers of the 1970s! This means you can easily crash a program using C, possibly even your computer. CS 136 Winter 2012 05 Introduction to C 2/35 Intro to C C gives you enough rope to shoot yourself in the foot. A good reference is essential: K. N. King: C Programming, A Modern Approach. We will take an idiomatic (as opposed to systematic) approach to learning C in class. You must follow up with reading the King text. Start with: Chapter 2: C Fundamentals Chapter 15: Writing Large Programs CS 136 Winter 2012 05 Introduction to C 3/35 C source files and modules C has primitive version of Rackets modules, based solely on source files. CS 136 Winter 2012 05 Introduction to C 4/35 C source files and modules C has primitive version of Rackets modules, based solely on source files. Implementation code goes in a file, e.g. foo.c //This is a function that doubles an integer int foo ( int i) { return i + i; } CS 136 Winter 2012 05 Introduction to C 4/35 C source files and modules C has primitive version of Rackets modules, based solely on source files. Implementation code goes in a file, e.g. foo.c //This is a function that doubles an integer int foo ( int i) { return i + i; } Interface/specification goes in a different file foo.h , called a header file. int foo( int ); CS 136 Winter 2012 05 Introduction to C 4/35 C source files and modules C has primitive version of Rackets modules, based solely on source files. Implementation code goes in a file, e.g. foo.c //This is a function that doubles an integer int foo ( int i) { return i + i; } Interface/specification goes in a different file foo.h , called a header file....
View Full Document

This note was uploaded on 02/22/2012 for the course CS cs136 taught by Professor Cormack during the Winter '10 term at Waterloo.

Page1 / 53

05-intro-functions_in_C - Computer Science 136: David R....

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online