lecture 1-overview of c

lecture 1-overview of c - Programming in C An Overview 1...

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

View Full Document Right Arrow Icon
1 Programming in C An Overview
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 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. 1. C is the Standard Developmental Language for personal computers. Much of : Many windowing packages, Data Base PGMS, Graphic Libraries & other Large Application Packages are written in ‘C’
Background image of page 2
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.
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 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.
Background image of page 4
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 . . . .
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 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.
Background image of page 6
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.
Background image of page 7

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

View Full DocumentRight Arrow Icon
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
Background image of page 8
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’…. .
Background image of page 9

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

View Full DocumentRight Arrow Icon
10 A character, or more likely a sequence of characters, enclosed in “ double quotes ”. A string
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 58

lecture 1-overview of c - Programming in C An Overview 1...

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