HISTRY OF C++ :
history :
- C++ was invented by Bjarne Stroustrup in 1979 , at Bell laboratories in murray hill , New Jersey. He initially called new language "C with classes" . in 1983 the name was changed to C++ .
- instead, he enhanced an already highly successful language . most of the features that stroustrup added to c were designed to support object-oriented programing . in essence , C++ is object-oriented version of c.
- middle level language .
- it support object-oriented programing.
- C++ follow bottom up approch.
- java is written in C++
Every words in C++ language is a keyword or an identifier . Keywords in C++ language can not be used as a variable name . They are specifically used by the compiler for its own purpose and they serve as building blocks of a C++ program.
C++ language has some reserve word which are called keywords. They are the part of the C++ tokens.
There are 63 keywords currently defined for standard C++.
C++ Keyword | |||
---|---|---|---|
asm | double | new | switch |
auto | else | operator | template |
break | enum | private | this |
case | extern | protected | throw |
catch | float | public | try |
char | for | register | typedef |
class | friend | return | union |
const | goto | short | unsigned |
continue | if | signed | virtual |
default | inline | sizeof | void |
delete | int | static | volatile |
do | long | struct | while |
IDENTIFIER :
the name of a variable , function , class , or other entity in c++ is called an identifier.
rules :
- The identifier can not be a keyword . Keywords are reserved .
- The identifier can only be composed letters, number , and the underscore character . that means the name can not contains symbols nor whitespace .
- The identifier must begin with a letter or an underscore . it can not start with a number ,
- C++ distinguishes between lower and upper case letter .
VARIABLE: A variable is a value that can change anytime . It is a memory location used to store a data value . variable name is case sensitive.
- They must always begin with a letter , although some system permit underscore as the first character.
- The length of a variable most not be more than 8 character.
- white space is not allowed .
- a variable should not be a keyword.
- it should not contain any special characters.
"Data types specifies the type and size of data . "
A program contains different types of data (integer , real , character etc.) and need to store values being used in the program . C++ language is rich of data types .
It is divided into three types ------------------
Data Type | Size (in bytes) | Range |
---|---|---|
short int | 2 | -32,768 to 32,767 |
unsigned short int | 2 | 0 to 65,535 |
unsigned int | 4 | 0 to 4,294,967,295 |
int | 4 | -2,147,483,648 to 2,147,483,647 |
long int | 4 | -2,147,483,648 to 2,147,483,647 |
unsigned long int | 4 | 0 to 4,294,967,295 |
long long int | 8 | -(2^63) to (2^63)-1 |
unsigned long long int | 8 | 0 to 18,446,744,073,709,551,615 |
signed char | 1 | -128 to 127 |
unsigned char | 1 | 0 to 255 |
float | 4 |
|
double | 8 |
|
long double | 12 |
|
wchar_t | 2 or 4 | 1 wide character |
No comments:
Post a Comment