Docsity

Introduction to C, Lecture notes of Programming Languages

Partial preview of the text

Download Introduction to C and more Lecture notes Programming Languages in PDF only on Docsity!

Introduction to C

CS 2022: Introduction to C

Instructor: Hussam Abu-Libdeh

Presented by: Renato Paes Leme

Cornell University

Fall 2009, Lecture 1

Administrivia

I Instructor: Hussam Abu-Libdeh, 4139 Upson

I Email: [email protected]

I Lectures: MWF 12:20–1:10p, THR 205

I Lab: Upson B7 (when announced)

I Office Hours: To Be Determined

I www.cs.cornell.edu/courses/cs2022/

I CMS: http://cms.csuglab.cornell.edu/

C is a language...

..., like English.

What are languages for?

C is a language...

..., like English.

What are languages for?

I communicate ideas

I convince someone

I express feelings and beliefs

I vehicle for art

I state ideas

I ...

Computer generated poetry

Imagine now a tree in white sails still whirled

About the leaves

will be of silences

Calm and angels

Social Sciences

Zachary’s karate club

Design useful tools

How to learn a foreign language?

1. be able to express yourself

2. have someone to correct your grammar

3. develop some style

4. communicate efficiently

5. say original and interesting things

Pre-requisites

I Basic programming knowledge

(variables, functions, loops)

I Lots of composure

I Your programs won’t compile

I Your programs won’t run

I Your programs will crash

I You’ll have no idea what happened

I ... but at least it’ll happen fast!

Programming Languages Genealogy

History of C

I Writing code in an assembler gets real old real

fast

I Really low level (no loops, functions, if-then-else)

I Not portable (different for each architecture)

I BCPL (by Martin Richards): Grandparent of C

I Close to the machine

I Procedures, Expressions, Statements, Pointers,...

I B (by Ken Thompson): Parent of C

I Simplified BCPL

I Some types (int, char)

History of C

I C (by Kernighan and Ritchie)

I Much faster than B

I Arrays, Structures, more types

I Standardization

I Portability enhanced

I Parent of Objective C, Concurrent C, C*, C++

When not to use C

Use JAVA or C# for...

I Quick prototype

I Compile-once Run-Everywhere

I Reliability is critical, and performance is

secondary

I C can be very reliable, but requires tremendous

programmer discipline

I For many programs, JAVA can match C

performance, but not always

How to be good programmer