bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/C++/C++ Reference
C++•C++ Reference

C++ Keywords

Flash cards

Review the key moves

1/3
Core idea

What is the main idea behind C++ Keywords?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

A list of useful keywords in C++ can be found in the table below.

KeywordDescription
andAn alternative way to write the logical && operator
and_eqAn alternative way to write the &= assignment operator
autoAutomatically detects the type of a variable based on the value you assign to it
bitandAn alternative way to write the & bitwise operator
bitorAn alternative way to write thebitwise operator
boolA data type that can only store true or false values
breakBreaks out of a loop or a switch block
caseMarks a block of code in switch statements
catchCatches exceptions generated by try statements
charA data type that can store a single character
classDefines a class
complAn alternative way to write the ~ bitwise operator
constDefines a variable or parameter as a constant (unchangeable) or specifies that a class method does not modify attributes of the class
continueContinues to the next iteration of a loop
defaultSpecifies the default block of code in a switch statement
deleteFrees dynamic memory
doUsed together with while to create a do/while loop
doubleA data type that is usually 64 bits long which can store fractional numbers
elseUsed in conditional statements
enumDeclares an enumerated type
falseA boolean value equivalent to 0
floatA data type that is usually 32 bits long which can store fractional numbers
forCreates a for loop
friendSpecifies classes and functions which have access to private and protected members
gotoJumps to a line of code specified by a label
ifMakes a conditional statement
intA data type that is usually 32 bits long which can store whole numbers
longEnsures that an integer is at least 32 bits long (use long long to ensure 64 bits)
namespaceDeclares a namespace
newReserves dynamic memory
notAn alternative way to write the logical ! operator
not_eqAn alternative way to write the != comparison operator
orAn alternative way to write the logicaloperator
or_eqAn alternative way to write the= assignment operator
privateAn access modifier which makes a member only accessible within the declared class
protectedAn access modifier which makes a member only accessible within the declared class and its children
publicAn access modifier which makes a member accessible from anywhere
returnUsed to return a value from a function
shortReduces the size of an integer to 16 bits
signedSpecifies that an int or char can represent positive and negative values (this is the default so the keyword is not usually necessary)
sizeofAn operator that returns the amount of memory occupied by a variable or data type
staticSpecifies that an attribute or method belongs to the class itself instead of instances of the class Specifies that a variable in a function keeps its value after the function ends
structDefines a structure
switchSelects one of many code blocks to be executed
templateDeclares a template class or template function
thisA variable that is available inside class methods and constructors which contians a pointer to a class instance
throwCreates a custom error which can be caught by a try...catch statement
trueA boolean value equivalent to 1
tryCreates a try...catch statement
typedefDefines a custom data type
unsignedSpecifies that an int or char should only represent positive values which allows for storing numbers up to twice as large
usingAllows variables and functions from a namespace to be used without the namespace's prefix
virtualSpecifies that a class method is virtual
voidIndicates a function that does not return a value or specifies a pointer to a data with an unspecified type
whileCreates a while loop
xorAn alternative way to write the ^ bitwise operator
xor_eqAn alternative way to write the ^= assignment operator

Next

C++ iostream Library (Standard Input / Output Streams)