overview (2)

overview (2) - 1 Programming in C An Overview 2...

Info iconThis preview shows pages 1–11. 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

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: 1 Programming in C An Overview 2 C-Programming General Purpose Language Developed by Dennis Ritchie of Bell Labs (1972). First used as The Systems Language for The UNIX operating system. Why ‘C’ 1. C is a SMALL Language. Small is beautiful in programming. Fewer key words but powerful. 2. C is the Standard Developmental Language for personal computers. Much of : MS-DOS & OS/2 Many windowing packages, Data Base PGMS, Graphic Libraries & other Large Application Packages are written in ‘C’ 3 3. ‘C’ is Portable- easily moved from machine to machine. Provides a standard library of functions that work the same on all machines. Built in Preprocesso r- helps isolate any system dependent code. 4. ‘C’ is Terse- very powerful set of operators. Can accomplish in 1 statement what might require many statements in another language. A Terse language explicitly magnifies the underlying productivity of the programmers. 5. ‘C’ is Modular- Supports Structured Programming. Functions - Internal – External. Supports user - Defined Libraries of Functions. Supports Privacy by using “Static” storage Class within files. 4 Lexical Elements of the C Language • C Program is viewed as a sequence of Tokens separated by White Space (i.e., spaces, tabs, new lines). These tokens include: – Keywords. – Identifiers. – Constants. – String constants. – Operators. – Punctuators. 5 Keywords • Reserved words . • Cannot be redefined or used in other contexts. • Case sensitive. • Have a special predefined meaning. See pg. 46 . E.g, for, while, if, void . . . . 6 Identifiers • The names of variables, functions, labels and other user-defined items are called identifiers . • May be any length. – ANSI C – First 31 characters are recognized. • Cannot be the same as a keyword and should not have the same name as pre- defined C functions. • Case sensitive . – E.g., count, Count and COUNT are three separate identifiers. 7 • The first character must be a letter or an underscore, and subsequent characters must be either letters, digits or underscores. Correct Incorrect Count1 1count test23 hi!there high_balance high . . . Balance • Identifiers should be chosen to reflect their use in the program. 8 Constants • They refer to fixed values that the program may not alter. • They can be of any of the basic data types . Integer : 1. Decimal 2. Octal (Base 8) Digits 0. .7 3. Hexadecimal (Base 16) Digits 0…9, A…F 9 Floating Point : Need a decimal pt or Scientific notation. 23.7 .16 1.604 2e3 Character : Any single printable character in single quotes . ‘?’, ‘A’, ‘9’….. 10 • A character, or more likely a sequence of characters, enclosed in “ double quotes ”....
View Full Document

This note was uploaded on 03/07/2012 for the course CSCE 206 taught by Professor Hurley during the Spring '11 term at Texas A&M.

Page1 / 58

overview (2) - 1 Programming in C An Overview 2...

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

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