C Basics

Last time: Unix processes and redirection

Prof. Brian D. Davison

Computer Science & Engineering, Lehigh University

Announcements

C versus C++

Do the students know?

Major C differences from C++

Other Differences

So what stays the same? Glad you asked...

Basic C Data Types

int is signed, 32 bits on typical (but not all) platforms. float typically 32bits, double typically 64, long double 128

Operators

As always, multiplication and division have precedence over addition/subtraction; use parenthesis to make things clear

Assignment Operators

Type Conversions

Type Conversions continued

Quick test: what is the result of 1.0 + 3/2?

Control Flow

C Arrays

Array Initialization

Multidimensional Arrays

Rest of a[][] is initialized to 0.

Character Arrays

Looking Ahead