1 / 12

Comprehensive Overview of Loops, Arrays, Functions, and More in Test 2

Explore while loops, for loops, nested loops, arrays, functions, scope, and more! Learn syntax, style, use cases, and characteristics to master coding concepts. Dive into 2D arrays, functions with arrays, and the importance of stubs and drivers.

ejean
Download Presentation

Comprehensive Overview of Loops, Arrays, Functions, and More in Test 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Test 2 Review Outline

  2. Loops • while • syntax & style • SVRL • EOF • characteristics • loop control variable must change value • pretest • may not be executed • when to use

  3. Loops • do … while • syntax & style • characteristics • loop control variable must change value • postest • always executed at least once • when to use

  4. Loops • for • syntax & style • three expressions (initialization, continue test, update) • increment/decrement operators • scope • characteristics • pretest

  5. Loops Nested loops

  6. 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

  7. 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

  8. 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

  9. 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

  10. 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

  11. Functions and 2-D Arrays • Specification of 2-D array as parameter • in the prototype • in the definition • calling the function

  12. Stubs & Drivers • What they are used for • What is a stub • characteristics • What is a driver • characteristics

More Related