C++ programming tutorial
This tutorial is about C++ Programming language. I will teach C++ from very basics to advanced level in this post and upcoming posts. Just wait and read all the posts regularly.
This tutorial is mainly about theoretical knowledge but is very important!
Some Definitions :
- Bit : It is the smallest unit a computer can understand. it is either 0 or 1. 0 generally means circuit is OFF and 1 means ON.
- ASCII : All characters on keyboard have a code which is known as ASCII code.
Range A-Z -> 65-90
a-z -> 97-122
- Byte : Group of 8 bits. 1 byte means 1 character.
- Program : It is a step by step instruction which tell what to do and how to do.
- Object Code : A program which a machine can understand is called Object Program.
A program which converts source code[ English like step wise instruction to computer] to object code[language which a machine can understand].
IT executes the entire program at once and hence It is faster.
A program which converts source code[ English like step wise instruction to computer] to object code[language which a machine can understand]. But the interpreter executes the program line by line and hence it is slower.
Integer Constant :
- Consist of 0-9
- Doesn’t includes commas or spaces.
- Preceded by a + or – sign. + sign is assumed if there isn’t any sign.
Character constants : Any single character enclosed in single quote (‘). Ex :- ‘a’ , ’b’ .
Strings : Generally consist of more than one character within double quote (“).
Ex: “comp”, “abcd”.
Difference between String and Character :
Character constant takes 1 byte for storage while string constant takes 2 bytes for storage because in String a byte is reserved for Null Byte.
Memory representation :
Character : ‘A’ == |A| << stored in one memory cell
String : “A” == |A| | << stored in 2 memory cells with