1.x Chapter 1 summary and quiz

주홍영·2022년 3월 10일
0

Learncpp.com

목록 보기
24/199

https://www.learncpp.com/cpp-tutorial/chapter-1-summary-and-quiz/

A statement is a type of instruction that causes the program to perform some action. Statements are often terminated by a semicolon.

A function is a collection of statements that execute sequentially. Every C++ program must include a special function named main. When you run your program, execution starts at the top of the main function.

The rules that govern how elements of the C++ language are constructed is called a syntax. A syntax error occurs when you violate the grammatical rules of the language.

Comments allow the programmer to leave notes in the code. C++ supports two types of comments. Line comments start with a // and run to the end of the line. Block comments start with a / and go to the paired / symbol. Don’t nest comments.
You can use comments to temporarily disable lines or sections of code. This is called commenting out your code.

Data is any sequence of symbols that can be interpreted to mean something. A single piece of data, stored somewhere in memory is called a value.

A variable is a named piece of memory that we can use to store values. A variable’s name is called an identifier. In order to create a variable, we use a statement called a definition statement. When the program is run, each defined variable is instantiated, which means it is assigned a memory address.

Initialization can be used to give a variable a value at the point of creation. C++ supports 3 types of initialization: copy initialization, direct initialization, and uniform initialization (also called list initialization or brace initialization).

A variable that has not been given a value is called an uninitialized variable. Trying to get the value of an uninitialized variable will result in undefined behavior, which can manifest in any number of ways.

C++ reserves a set of names called keywords. These have special meaning within the language and may not be used as variable names.

A literal constant is a fixed value inserted directly into the source code. Examples are 5 and “Hello world!”.

An operation is a mathematical calculation involving zero or more input values, called operands. The specific operation to be performed is denoted by the provided operator. The result of an operation produces an output value.

Unary operators take one operand. Binary operators take two operands, often called left and right. Ternary operators take three operands.

An expression is a combination of literals, variables, operators, and function calls that are evaluated to produce a single output value. The calculation of this output value is called evaluation. The value produced is the result of the expression.

An expression statement is an expression that has been turned into a statement by placing a semicolon at the end of the expression.

Quiz

Q1 What is the difference between initialization and assignment?

Initialization provides a variable with an initial value (at the point of creation). Assignment gives a variable a new value after the variable has already been defined.

profile
청룡동거주민

2개의 댓글

comment-user-thumbnail
2023년 6월 29일

This is a very fascinating soccer random. I'm grateful to have learned so much about the various types of support.

답글 달기
comment-user-thumbnail
2024년 4월 9일

If you're looking for Indore Escort Services call us right away. We offer continuous same-day availability. Our escorts are highly educated and speak English perfectly. and understand how to provide you with sexual happiness. in less time.

답글 달기