C++ Recap

I am recaping what I learned from tutorialspoint.com so far

Identifier:I can define taht is c++
Keyword:Some reserved keywords on a language
Whitespace: gape between two text
Trigraphs:We can define some sign in other ways

cout<<"Print"<<endl;//for print and newline

 //comments

/* Comment */

 

Data Types:
Primitive Built In Types
int  //integer type
float //floating point(doshomik)
char //character like ‘A’ ‘B’ C’ ‘D’
double //double floating point
void //Valueless
w_char //Wide character

Those data types can be modified by this

signed //positive and negative both
unsigned //positive
short //2 bytes
long //4 bytes

So if we modify those then we can get those in the chart

Type                     But Width Of Type                Range of Type
char                              1byte                          -127 to 127 or 0 to 255
unsigned char                1 byte                                 0 to 255
signed char                    1 byte                               -127 to 127

int                                  4bytes
unsigned int                 4bytes
signed int                      4 bytes

short int                          2 bytes
unsigned short int       need range
signed short int           need range

long int                        4 bytes
unsigned long int        4 bytes
signed long int              4 bytes

float                           4 bytes
double                           8 bytes
long double                  8 bytes

wchar_t                    2 or 4 bytes

Typedef:

We can define type to any name

like this default syntax

typedef int zakilive

zakilive a; //Here zakilive is representing type int

Enumerated data types:
We can learn from syntax

enum enum-name{list of names} var-list

enum color{red,green,blue} c;
c=green;

enum color{red,green=5,blue};

so value of blue is 6

Variable Types:

We can use extern keyword to find codes from outside file

we have to know lvalue and rvalue

rvalue is right side after equal sign/assignment operator
lvalue is left side after equal sign/assignment operator[refer to memory location]

Variable Scope:
Local[define variable inside a function]
Global[define outside of a function but use in any function on the desired code]

Literals:
legal or illegal for various type integer literals,float literals,character literals,boolean type literals etc

Boolean : True or False
character literals:
example:
\\
\a  /*beep */
\b backspace
\f formfeed
\n newline
Constants
#define
const

Modifier Types:
Same as above mentioned

Storage Class:
auto
register
static
extern
mutable

C++ Operators:
Arithmetic
Logical
Bitwise
Assignment
Relational
Ternary
dot->arrow
sizeof
comma,
casting,
~(it means binary ones complement and effects of flipping bits here (~A) = -61 which is 1100 0011 in 2s complement form due to a signed binary number),
pointer operator &(define address of a variable) example variable:zaki address on memory location &zaki
pointer operator *(define variable) example:pointint to a variable zaki by this *zaki
Operators precedence

 

 

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *