What is the role of `int main()` in a C++ program?
`main` is the program’s entry-point function and returns an integer status to the operating system.
Study 01 C++ Fundamentals and Program Structure with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is the role of `int main()` in a C++ program?
`main` is the program’s entry-point function and returns an integer status to the operating system.
What does the `std::` prefix indicate?
The `std::` prefix identifies names provided by the C++ standard library’s `std` namespace and helps prevent name conflicts.
How do C++ header and source files commonly differ?
Header files commonly contain declarations, templates, and shared definitions; source files commonly contain function and class definitions.
What is a C++ translation unit?
A translation unit is the source produced after an included file’s contents are conceptually incorporated and prepared for compilation.
What are the typical stages from C++ source to execution?
Preprocessing handles directives, compilation checks and generates lower-level code, linking combines objects and libraries, and execution runs the executable.
What does GCC’s `-c` option do?
The `-c` option stops after compilation, producing an object file without performing the linking stage.
How do C++ single-line and block comments differ?
`//` comments continue to the line’s end, while `/* ... */` comments can span multiple lines.
What are the basic rules for ordinary C++ identifiers?
An identifier starts with a letter or underscore; later characters may also include digits. Identifiers are case-sensitive.
Why can’t `class` be used as a variable name?
A keyword has a predefined language meaning and normally cannot be used as a programmer-defined identifier, such as `class`.
What is a literal in C++?
A literal is a value written directly in source code, such as `42`, `3.14`, `'A'`, `"C++"`, `true`, or `nullptr`.
How does an expression differ from a statement?
An expression produces a value or performs an operation; a statement specifies an action or control operation. An expression followed by `;` is an expression statement.
How does C++ write formatted output to the console?
`std::cout` sends output through the standard output stream using the insertion operator `<<`.