
Structured Programming in C 1
10/25/2007
Ward 1
Ronnie Ward
Exam 2 REVIEW
C by Dissection by Kelly/Pohl
Class WEB SITE:
http://courses.cs.tamu.edu/ward/206.f07/
CPSC 206: Structured
Programming in C
10/25/2007
Ward 2
Chapter 1 Summary
• Algorithms, procedures
• C program structure
• preprocessor directives
#define identifier rep_string
#define identifier
#include <stdio.h>
• main() function
• declarations
• statements
• printf & scanf
(control string, arguments)
• Constants, variables
• Function calls
• Operators: = + - * / %
• Expressions
• while (expression true)
statement
• Development process
• Development environments
– UNIX and PC
10/25/2007
Ward 3
Chapter 2 Summary
• Tokens and separators
• Comments /* … */
• Reserved tokens
• Identifiers
• Constants (so far)
– integer, float, double,
character and string
• Operators
– Precedence
– Associativity
– Binary, unary, pre/post
fix
• Standard library
functions (p. 545)
#include <stdlib.h>
– Eg. rand()
10/25/2007
Ward 4
Chapter 3 Summary
• Define true and false
– true (not 0) and false (0)
• operators yielding 0 or 1
– true (1) and false (0)
– relational < > <= >=
– equality == !=
– logical ! && ||
• negation (!) is unary
– value is 0 or 1
– !!val is usually not val
• Compound statement {…}
• if and if-else statements
• conditional operator ?:
• Loop control statements
– for, while, do-while
• break, continue and return
– Unconditional transfer of
control
• Avoid goto statement
• switch statement—later