C++ Data Types
A data type specifies the type of data that a variable can store such as
integer, floating, character etc.
There are 4 types of data types in C++ language.
Types |
Data Types |
Basic Data Type |
int, char, float, double, etc |
Derived Data Type |
array, pointer, etc |
Enumeration Data Type |
enum |
User Defined Data Type |
structure |
Basic Built in types
char |
for character storage ( 1 byte ) |
int |
for integral number ( 2 bytes ) |
float |
single precision floating point ( 4 bytes ) |
double |
double precision floating point numbers ( 8 bytes
) |
Other Built in types
bool |
Boolean ( True or False ) |
void |
Without any Value |
wchar_t |
Wide Character |
Modifiers
Specifiers modify the meanings of the predefined built-in data types and
expand them to a much larger set. There are four data type modifiers in C++,
they are :
- long
- short
- signed
- unsigned
C++ Keywords
A keyword is a reserved word. You cannot use it as a variable name, constant
name etc.
A list of 32 Keywords in C++ Language which are also available
in C language are given below.
auto |
break |
case |
char |
const |
continue |
default |
do |
double |
else |
enum |
extern |
float |
for |
goto |
if |
int |
long |
register |
return |
short |
signed |
sizeof |
static |
struct |
switch |
typedef |
union |
unsigned |
void |
volatile |
while |
A list of 30 Keywords in C++ Language which are not available in C
language are given below.
asm |
dynamic_cast |
namespace |
reinterpret_cast |
bool |
explicit |
new |
static_cast |
false |
catch |
operator |
template |
friend |
private |
class |
this |
inline |
public |
throw |
const_cast |
delete |
mutable |
protected |
true |
try |
typeid |
typename |
using |
virtual |
wchar_t |
Basic types of Variables
Each variable while declaration must be given a datatype, on which the memory
assigned to the variable depends. Following are the basic types of
variables,
bool |
For variable to store boolean values( True or False ) |
char |
For variables to store character types. |
int |
for variable with integral values |
float and double are also types for variables with large and
floating point values |
Operators in C++
Types of operators
- Assignment Operator
- Mathematical Operators
- Relational Operators
- Logical Operators
- Bitwise Operators
- Shift Operators
- Unary Operators
- Ternary Operator
- Comma Operator
No comments:
Post a Comment
Please write your view and suggestion....