0% found this document useful (0 votes)
2 views

C++_Concepts_Full_Format

The document provides an overview of C++ concepts, including tokens, reference variables, and the differences between inline and normal functions. It outlines types of variables and operations available in C++, as well as the use of the scope resolution operator. Key features and examples are presented to illustrate these concepts.

Uploaded by

testrest227
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

C++_Concepts_Full_Format

The document provides an overview of C++ concepts, including tokens, reference variables, and the differences between inline and normal functions. It outlines types of variables and operations available in C++, as well as the use of the scope resolution operator. Key features and examples are presented to illustrate these concepts.

Uploaded by

testrest227
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

C++ Concepts Notes

C++ Tokens

Tokens are the smallest units of a C++ program.

Types of tokens:

1. Keywords

2. Identifiers

3. Literals

4. Operators

5. Punctuators

6. Comments

Reference Variables

A reference variable is an alias for an existing variable.

Example:

int a = 5;

int &ref = a;

ref = 10; // a becomes 10

Inline Function vs Normal Function

Example of Inline Function:

inline int square(int x) {

return x * x;

Difference Between Inline and Normal Function

Feature Inline Function Normal Function

Function Call Code inserted directly Function is called


C++ Concepts Notes

Speed Faster Slower (due to call)

Usage Best for small functions Better for big functions

Code Size May increase Compact

Memory Uses more Efficient

Variables and Operations in C++

Types of Variables:

1. Local

2. Global

3. Static

4. Constant

5. Reference

Operations:

- Arithmetic: + - * / %

- Relational: == != > < >= <=

- Logical: && || !

- Assignment: = += -= etc.

Scope Resolution Operator

Used to access global variables or class functions defined outside.

Example:

int x = 10;

int main() {

int x = 20;

cout << ::x; // Outputs 10

You might also like