Lecture20 - ComputerProgrammingITAC162. Todays Agenda...

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

View Full Document Right Arrow Icon
1 Computer Programming I TA C162 . 22/02/06 Today’s Agenda Introduction to High level Languages Features of HLL Compiler vs Interpreter Introduction to C language Character Set Key words and Identifiers Constants Variables Data Types
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Computer Programming I TA C162 . 22/02/06 A High-Level Language Gives symbolic names to values Don’t need to know which register or memory location Convenient way to handle values Provides abstraction of underlying hardware Operations do not depend on instruction set Example: can write “ a = b * c ”, even though LC-3 doesn’t have a multiply instruction Provides expressiveness Use meaningful symbols that convey meaning Simple expressions for common control patterns (if-then-else) Complex tasks can be express with a smaller amount of code
Background image of page 2
3 Computer Programming I TA C162 . 22/02/06 A High-Level Language Enhances code readability Common control structures are expressed using, English like statements The program itself becomes easier to read. Safeguards against bugs Can enforce rules or conditions at compile-time or run-time If certain rules or conditions are violated, an error message will direct the programmer to the spot in the code. Language helps the programmer to get his program working for quickly.
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Computer Programming I TA C162 . 22/02/06 Compilation vs. Interpretation Consider the following algorithm: Get W from the keyboard. X = W + W Y = X + X Z = Y + Y Print Z to screen. If interpreting , how many arithmetic operations occur? If compiling , we can analyze the entire program and possibly reduce the number of operations. Can we simplify the above algorithm to use a single arithmetic operation?
Background image of page 4
5 Computer Programming I TA C162 . 22/02/06 Structure of a C Program Every C program consists of one or more modules called functions. One of the functions must be called main. Execution will always begin by main. Each compound statement is enclosed within a pair of braces. Each statement must end with a semicolon (;) Anything within /* */ treated as comments Comments may appear anywhere within program
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 Computer Programming I TA C162 . 22/02/06
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 25

Lecture20 - ComputerProgrammingITAC162. Todays Agenda...

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

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