The Stack and the Free Store in C++
Local variables are on the stack, along with function parameters. Code is in code space, of course, and global variables are in global name space. The registers are used for intern
Read tutorialTHE TUTORIAL LIBRARY
Local variables are on the stack, along with function parameters. Code is in code space, of course, and global variables are in global name space. The registers are used for intern
Read tutorialOnce a pointer is assigned the address of a variable, you can use that pointer to access the data in that variable. Program below demonstrates how the address of a local variable i
Read tutorialThe indirection operator (*) is also called the dereference operator. When a pointer is dereferenced, the value at the address stored by the pointer is retrieved.
Read tutorialEvery variable has an address. Even without knowing the specific address of a given variable, you can store that address in a pointer.
Read tutorialPointers present two special challenges when learning C++: They can be somewhat confusing, and it isn't immediately obvious why they are needed. This article introduces how pointer
Read tutorialif and if/else statements can become quite confusing when nested too deeply, and C++ offers an alternative. Unlike if, which evaluates one value, switch statements allow you to bra
Read tutorialLoops may be nested, with one loop sitting in the body of another. The inner loop will be executed in full for every execution of the outer loop. This c++ program illustrates writi
Read tutorialfor statements are powerful and flexible. The three independent statements (initialization, test, and action) lend themselves to a number of variations.
Read tutorialWhen programming while loops, you'll often find yourself setting up a starting condition, testing to see if the condition is true, and incrementing or otherwise changing a variable
Read tutorialIt is possible that the body of a while loop will never execute. The while statement checks its condition before executing any of its statements, and if the condition evaluates fal
Read tutorialThe condition tested in a while loop can be any valid C++ expression. As long as that condition remains true, the while loop will continue. You can create a loop that will never en
Read tutorialAt times you'll want to return to the top of a while loop before the entire set of statements in the while loop is executed. The continue statement jumps back to the top of the loo
Read tutorialOne example today. A better developer tomorrow.