1_Review_Ch_2-1

1_Review_Ch_2-1 - CIS 15AG 1 Review Chapter 2: Introduction...

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

View Full Document Right Arrow Icon
CIS 15AG Review Chapter 2: Introduction to the C Language C Language – designed by Dennis Ritchie, at Bell Laboratories, 1972 1972: traditional C 1989: ANSI C (American National Standards Institute) 1990: ISO C (International Standards Organization) 1999: C99 – current standard C Program – consists of one or more functions, one and only one of them must be named main() . Comments – for internal program documentation; are ignored by the compiler Block comment: /* Text to be written on more than one line */ Line comment: // an one line comment Reserved Words – words that have a predefined meaning that cannot be changed, such as if , else , for , do , while , etc. Identifiers – used in a language to name data and other objects, such as area , length , score , stuID , etc. C is case sensitive: tax and TAX are different identifiers. Rules for identifiers: consists of only letters, digits, or '_', the first character must be a letter or '_', it cannot be a reserved word, and the first 63 characters are significant. Choose meaningful identifiers! Type : – a type defines a set of values and a set of operations that can be applied on those values. C Types void – no values, no operations, but very useful: int main( void ) – integral – boolean bool only two values: false 0 true any non-zero value – character char set of values: most computers are using the ASCII alphabet; a character is stored in the memory as an integer, its ASCII code – integer short int 2 bytes: -32,768 to 32,767 int 4 bytes: -2,147,483,648 to 2,147,483,647 long int 4 bytes long long int 8 bytes (19 digits) unsigned short 2 bytes: 0 to 65,535 unsigned int 4 bytes: 0 to 4,294,967,295 – floating-point – real float , double , long double – imaginary (optional) – complex (optional) – derived (later) Variable a named memory location; in addition to its name , a variable has a type , a value , and an address . The type gives the size of the memory location (bytes), determines 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/02/2011 for the course CIS 15BG taught by Professor Staff during the Spring '10 term at DeAnza College.

Page1 / 5

1_Review_Ch_2-1 - CIS 15AG 1 Review Chapter 2: Introduction...

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

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