Lecture 4: Machines & binary
Tuesday, September 13, 2011 Status: complete[Up] [Previous Lecture] [Next Lecture]
Powerpoint Slides: CL03_Architecture.ppt (Chang)
Reading Assigned: 1.1-1.3
Homework Due: Homework 1
Homework Assigned: Homework 2
Topics Covered:
- Basic machine architecture: major components of a computer system.
- Converting numbers between decimal and binary
- Demo "Hello World" in C.
- Classwork 04 postponed to next class.
Programs Shown:
- A first C program. All it does is print out "Hello World". Program hello.c and sample run hello.txt.
- This second program does a bit more printing. Notice the use of comments and what happens when you omit the \n in a printf statement. Program hello2.c and sample run hello2.txt.
- Our third program prints out even more. Here we introduce "variables" in a program. We can store values of different types (e.g., integer and floating point values) in variables. The printf statement can print out the value stored in a variable using placeholders: %d for integers and %f for floating point values. Program hello3.c and sample run hello3.txt.