Uninitialized Variables Cause Run-Time Problems in C++
Using an uninitialized object is a common program error, and one that is often difficult to uncover. The compiler is not required to detect a use of an uninitialized variable, alth
Read tutorialTHE TUTORIAL LIBRARY
Using an uninitialized object is a common program error, and one that is often difficult to uncover. The compiler is not required to detect a use of an uninitialized variable, alth
Read tutorialC++ reserves a set of words for use within the language as keywords. Keywords may not be used as program identifiers. Table 1 below lists the complete set of C++ keywords.
Read tutorialSome operators, such as assignment, require that one of their operands be an lvalue. As a result, lvalues can be used in more contexts than can rvalues. The context in which an lva
Read tutorialThere is a more primitive (and less useful) way to handle long strings that depends on an infrequently used program formatting feature: Putting a backslash as the last character on
Read tutorialTwo string literals (or two wide string literals) that appear adjacent to one another and separated only by spaces, tabs, or newlines are concatenated into a single new string lite
Read tutorialAll of the literals we've seen so far have primitive built-in types. There is one additional literalstring literalthat is more complicated. String literals are arrays of constant c
Read tutorialSome characters are nonprintable. A nonprintable character is a character for which there is no visible image, such as backspace or a control character. Other characters have speci
Read tutorialThe number of integral types in C++ can be bewildering. C++, like C, is designed to let programs get close to the hardware when necessary, and the integral types are defined to cat
Read tutorialA logical extension of summing the values between 1 and 10 is to sum the values between two numbers our user supplies. We might use the numbers directly in our for loop, using the
Read tutorialPart of the compiler's job is to look for errors in the program text. A compiler cannot detect whether the meaning of a program is correct, but it can detect errors in the form of
Read tutorialIn our while loop, we used the variable val to control how many times we iterated through the loop. On each pass through the while, the value of val was tested and then in the body
Read tutorialA while statement provides for iterative execution. We could use a while to write a program to sum the numbers from 1 through 10 inclusive as follows:
Read tutorialOne example today. A better developer tomorrow.