• Navigate
    • 5.9 — std::string_view (part 2)
    • Table of contents
    • 5.7 — Introduction to std::string
  • Site Index
  • Latest Changes
  • About
    • Leave feedback
    • Report an issue
    • Contact / Support
    • Site FAQ
    • Privacy Policy
    • Donate
  •  
  • Search
Learn C++
Learn C++
Skill up with our free tutorials
Skip to content
  • Navigate
    • 5.9 — std::string_view (part 2)
    • Table of contents
    • 5.7 — Introduction to std::string
  • Site Index
  • Latest Changes
  • About
    • Leave feedback
    • Report an issue
    • Contact / Support
    • Site FAQ
    • Privacy Policy
    • Donate
  •  
  • Search
Category: C++ Tutorial

Category: C++ Tutorial

5.8 — Introduction to std::string_view

413

Consider the following program: #include <iostream> int main() { int x { 5 }; // x makes a copy of its initializer std::cout << x << ‘\n’; return 0; } When the definition for x is executed, the initialization value 5 is copied into the memory allocated for variable int …

nascardriver November 2, 2019, 7:17 am PDT November 26, 2024
Continue reading"5.8 — Introduction to std::string_view"

O.1 — Bit flags and bit manipulation via std::bitset

136

On modern computer architectures, the smallest addressable unit of memory is a byte. Since all objects need to have unique memory addresses, this means objects must be at least one byte in size. For most variable types, this is fine. However, for Boolean values, this is a bit wasteful (pun …

Alex August 17, 2019, 12:06 pm PDT February 15, 2025
Continue reading"O.1 — Bit flags and bit manipulation via std::bitset"

6.3 — Remainder and Exponentiation

431

The (also commonly called the or ) is an operator that returns the remainder after doing an integer division. For example, 7 / 4 = 1 remainder 3. Therefore, 7 % 4 = 3. As another example, 25 / 7 = 3 remainder 4, thus 25 % 7 = 4. …

Alex August 17, 2019, 11:57 am PDT December 30, 2024
Continue reading"6.3 — Remainder and Exponentiation"

4.10 — Introduction to if statements

405

Consider a case where you’re going to go to the market, and your roommate tells you, “if they have strawberries on sale, buy some”. This is a conditional statement, meaning that you’ll execute some action (“buy some”) only if the condition (“they have strawberries on sale”) is true. Such conditions …

Alex April 23, 2019, 12:57 pm PDT February 11, 2025
Continue reading"4.10 — Introduction to if statements"

4.7 — Introduction to scientific notation

133

Before we talk about our next subject, we’re going to sidebar into the topic of scientific notation. Scientific notation is a useful shorthand for writing lengthy numbers in a concise manner. And although scientific notation may seem foreign at first, understanding scientific notation will help you understand how floating point …

Alex April 23, 2019, 12:55 pm PDT January 29, 2025
Continue reading"4.7 — Introduction to scientific notation"

4.5 — Unsigned integers, and why to avoid them

361

In the previous lesson (), we covered signed integers, which are a set of types that can hold positive and negative whole numbers, including 0. C++ also supports unsigned integers. are integers that can only hold non-negative whole numbers. To define an unsigned integer, we use the unsigned keyword. By …

Alex April 23, 2019, 12:04 pm PDT August 29, 2024
Continue reading"4.5 — Unsigned integers, and why to avoid them"

3.x — Chapter 3 summary and quiz

351

Chapter Review A is an error that occurs when you write a statement that is not valid according to the grammar of the C++ language. The compiler will catch these. A occurs when a statement is syntactically valid, but does not do what the programmer intended. The process of finding …

Alex February 1, 2019, 12:04 pm PST August 13, 2024
Continue reading"3.x — Chapter 3 summary and quiz"

3.10 — Finding issues before they become problems

60

When you make a semantic error, that error may or may not be immediately noticeable when you run your program. An issue may lurk undetected in your code for a long time before newly introduced code or changed circumstances cause it to manifest as a program malfunction. The longer an …

Alex February 1, 2019, 12:03 pm PST October 14, 2024
Continue reading"3.10 — Finding issues before they become problems"

3.9 — Using an integrated debugger: The call stack

63

Modern debuggers contain one more debugging information window that can be very useful in debugging your program, and that is the call stack window. When your program calls a function, you already know that it bookmarks the current location, makes the function call, and then returns. How does it know …

Alex February 1, 2019, 12:02 pm PST June 5, 2023
Continue reading"3.9 — Using an integrated debugger: The call stack"

3.7 — Using an integrated debugger: Running and breakpoints

121

While stepping (covered in lesson ) is useful for examining each individual line of your code in isolation, in a large program, it can take a long time to step through your code to even get to the point where you want to examine in more detail. Fortunately, modern debuggers …

Alex February 1, 2019, 12:01 pm PST December 15, 2023
Continue reading"3.7 — Using an integrated debugger: Running and breakpoints"

Posts navigation

1 … 9 10 11 12 13 … 36

©2024 Learn C++ Privacy Policy