11.2 — Arrays (Part II)

This lesson continues the discussion of arrays that began in lesson . Initializing fixed arrays Array elements are treated just like normal variables, and as such, they are not initialized when created. One way to “initialize” an array is to do it element by element: int prime[5]; // hold the …

11.1 — Arrays (Part I)

Note: This chapter is a bit harder than the previous ones. If you feel a little discouraged, stick with it. The best stuff is yet to come! In lesson , you learned that you can use a struct to aggregate many different data types into one identifier. This is great …

7.10 — Break and continue

Although you have already seen the break statement in the context of switch statements (), it deserves a fuller treatment since it can be used with other types control flow statements as well. The causes a while loop, do-while loop, for loop, or switch statement to end, with execution continuing …

7.9 — For statements

By far, the most utilized loop statement in C++ is the for statement. The (also called a ) is preferred when we have an obvious loop variable because it lets us easily and concisely define, initialize, test, and change the value of loop variables. As of C++11, there are two …