BEST SITE FOR WEB DEVELOPERS

C++ Tutorial

C++ HOME C++ Intro C++ Get Started C++ Syntax C++ Output C++ Comments C++ Variables C++ User Input C++ Data Types C++ Operators C++ Strings C++ Math C++ Booleans C++ Conditions C++ Switch C++ While Loop C++ For Loop C++ Break/Continue C++ Arrays C++ Structures C++ Enums C++ References C++ Pointers

C++ Functions

C++ Functions C++ Function Parameters C++ Function Overloading C++ Scope C++ Recursion

C++ Classes

C++ OOP C++ Classes/Objects C++ Class Methods C++ Constructors C++ Access Specifiers C++ Encapsulation C++ Inheritance C++ Polymorphism C++ Files C++ Exceptions C++ Date

C++ How To

Add Two Numbers Random Numbers

C++ Reference

C++ Reference C++ Keywords C++ <iostream> C++ <fstream> C++ <cmath> C++ <string> C++ <cstring> C++ <ctime>

C++ Examples

C++ Examples C++ Compiler C++ Exercises C++ Quiz C++ Certificate

C++ Language. W3Schools in English. Lessons for beginners

Ua Es De Fr

C++ Keywords


C++ Keywords

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

Keyword Description
and An alternative way to write the logical && operator
and_eq An alternative way to write the &= assignment operator
bitand An alternative way to write the & bitwise operator
bitor An alternative way to write the | bitwise operator
bool A data type that can only store true or false values
break Breaks out of a loop or a switch block
case Mark a block of code in switch statements
catch Catches exceptions generated by try statements
char A data type that can store a single character
class Defines a class
compl An alternative way to write the ~ bitwise operator
const Defines a variable or parameter as a constant (unchangeable) or specifies that a class method does not modify attributes of the class
continue Continues to the next iteration of a loop
default Specify the default block of code in a switch statement
delete Free dynamic memory
do Used together with while to create a do/while loop
double A data type that is usually 64 bits long which can store fractional numbers
else Used in conditional statements
enum Declares an enumerated type
false A boolean value equivalent to 0
float A data type that is usually 32 bits long which can store fractional numbers
for Create a for loop
friend Specify classes and functions which have access to private and protected members
goto Jumps to a line of code specified by a label
if Make a conditional statement
int A data type that is usually 32 bits long which can store whole numbers
long Ensures that an integer is at least 32 bits long (use long long to ensure 64 bits)
namespace Declares a namespace
new Reserves dynamic memory
not An alternative way to write the logical ! operator
not_eq An alternative way to write the != comparison operator
or An alternative way to write the logical || operator
or_eq An alternative way to write the |= assignment operator
private An access modifier which makes a member only accessible within the declared class
protected An access modifier which makes a member only accessible within the declared class and its children
public An access modifier which makes a member accessible from anywhere
return Used to return a value from a function
short Reduces the size of an integer to 16 bits
signed Specifies that an int or char can represent positive and negative values (this is the default, so the keyword is not usually necessary)
sizeof An operator that returns the amount of memory occupied by a variable or data type
static Specify that an attribute or method belongs to the class itself instead of instances of the class
Specify that a variable in a function keeps its value after the function ends
struct Defines a structure
switch Select one of many code blocks to be executed
template Declare a template class or template function
this A variable that is available inside class methods and constructors which contains a pointer to a class instance
throw Creates a custom error which can be caught by a try...catch statement
true A boolean value equivalent to 1
try Create a try...catch statement
typedef Defines a custom data type
unsigned Specifies that an int or char should only represent positive values that allow for storing numbers up to twice as large
using Allows variables and functions from a namespace to be used without the namespace's prefix
virtual Specify that a class method is virtual
void Indicates a function that does not return a value or specifies a pointer to data with an unspecified type
while Create a while loop
xor An alternative way to write the ^ bitwise operator
xor_eq An alternative way to write the ^= assignment operator


Comments