120 likes | 185 Views
Test 2 Review Outline. Loops while syntax & style SVRL EOF characteristics loop control variable must change value pretest may not be executed when to use. Loops do … while syntax & style characteristics loop control variable must change value postest
E N D
Loops • while • syntax & style • SVRL • EOF • characteristics • loop control variable must change value • pretest • may not be executed • when to use
Loops • do … while • syntax & style • characteristics • loop control variable must change value • postest • always executed at least once • when to use
Loops • for • syntax & style • three expressions (initialization, continue test, update) • increment/decrement operators • scope • characteristics • pretest
Loops Nested loops
Arrays • Single Dimensional • syntax & style • size • index range • how stored in memory • data types • referencing single elements of the array • initializing syntax & rules • Parallel • Concerns • running off end • comparing • assigning one array to another • outputting content
Arrays • What kind of loop to use • ‘for’ loop used when know how many elements to store or process • usually ‘while’ is used if do not know • loop should count the number of stored elements
Arrays • Two-dimensional Arrays • syntax & style • how stored in memory • C – Strings • what it is (2-D array of char) • how used to store strings • referencing a single string in an array of C-strings
Functions • Syntax & Style • function definition • where located in source code file • header format • return type • parameter(s) • array as a parameter • using const • local variables • scope • calling functions • void functions • functions with return types other than void • boolean • other • function prototypes • Passing information to functions • Pass by value • Pass by reference • passing array elements • passing arrays
More Functions • Scope of a variable or function name • Lifetime • static local variables • global variables • where are their declaration(s) located • problems associated with • scope • initialization of • local variables with same name • global named constants • where are their declaration(s) located • when to use • local variables with same name • scope
Functions and 2-D Arrays • Specification of 2-D array as parameter • in the prototype • in the definition • calling the function
Stubs & Drivers • What they are used for • What is a stub • characteristics • What is a driver • characteristics