Lvalues and Rvalues in C++
Some 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 tutorialTHE TUTORIAL LIBRARY
Some 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 tutorialThere are two kinds of comments in C++: single-line and paired. A single-line comment starts with a double slash (//). Everything to the right of the slashes on the current line is
Read tutorialUsing the IO library, we can extend our main program to ask the user to give us two numbers and then print their sum:
Read tutorialOne example today. A better developer tomorrow.