L05 - CME/Energy 211 Margot Gerritsen Shela Aboud Emmet...

Info iconThis preview shows pages 1–6. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CME/Energy 211 Margot Gerritsen Shela Aboud Emmet Caulfield Lecture Overview Type Categories and Constants Control Statements Selection Statements: if and switch Iteration Statements: for , while and do-while Jump Statements: return , goto , break and continue Type Categories Basic (data) types int , char , float , double , void Floating types float , double , long double Enumeration types a set of named integer types Union types a set of overlapping nonempty objects Aggregate types array and structure types Integral types the set char , int and enum types Arithmetic types integral and floating types Scalar types arithmetic and pointer types Derived declaration types array, function and pointer types Incomplete types objects that lack enough information to determine their size lvalue an object type or incomplete type other than void ; basically an identifier that can appear on the LHS of an assignment In addition to the basic data type of a variable, objects and functions can be grouped to define other categories of type, i.e., derived types . Constants - Summary Integer Constant decimal constant (base 10) initial value is nonzero, uses characters 0-9; octal constant (base 8) initial value is zero, uses characters 0-7; hexadecimal constant (base 16) initial value is 0x or 0X, uses characters 0-9,a-f, or A-F Character Constant a character or one of the nongraphic characters represented by the escape sequences enclosed in a set of single quotes Floating Constant composed of a significant part and an exponential part. The significant portion is a sequence of number 0-9 to represent the whole number followed by a radix point (.) and a sequence of numbers representing the fractional part Enumeration Constant defined type int The value of a constant is in the range of representable values for its type (i.e., defined by its type). The Semicolon and Blocks Semicolon In C, the semicolon is a always ends a statement . An expression (e.g., x = 0 or i++ ) can become a statement when followed by a semicolon (e.g., x=0; or i++;) A semicolon by itself is a null statement (and performs no operation) Braces Braces are used to group declarations and statements together into a block, which is then equivalent to a single statement ....
View Full Document

Page1 / 25

L05 - CME/Energy 211 Margot Gerritsen Shela Aboud Emmet...

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

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