CYBERMIX | FORUM

Hello, Guest !

We would like to invite you to join our community.

Register & Login now Smile

( " We are currently recruiting forum staffs " )
CYBERMIX | FORUM

Hello, Guest !

We would like to invite you to join our community.

Register & Login now Smile

( " We are currently recruiting forum staffs " )
. Login Register
CYBERMIX | FORUM

WE POST EVERYTHING YOU NEED


You are not connected. Please login or register

Like this topic? Then share our topic !

URL Direct
BBcode
HTML
Data Type With C/C++ Language

View previous topic View next topic Go down  Message [Page 1 of 1]

Post: #1Wed Feb 11, 2015 11:31 pm

Anonymous

Guest

Guest
We might need to work with various data for programming. Such as, integer number ( 1, 2, 5, 7,……….) , floating number (2.5, 3.5, 8.9 ………), various character (a….z, A…..Z, #, &) etc. In C programming these are classified four types→


 Data Type
Example
  Description
char
‘S’ or ‘J’
Various character
 int
325759
Integer value
 float
3.1416
Floating number
 double
8.430896314
Floating number greater than float.


These four types are known as basic built-in data type in C/C++ Language. This data is kept in memory while running program and different data takes different memory in RAM. Such as


Data type
Memory space
 Range
 char
1 byte or 8 bit
Any number between -128 to 127 but it is used only to keep ASCII character.
integer
2 byte or 16 bit
Any number between -32768 to 32767
 float
4 byte or 32 bit
Any number between
double
8 byte or 64 bit
Any number between
 


Example

[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this link.]
void main()
{
clrscr();
 printf("char takes %d byte\n",sizeof(char));
printf("int takes %d byte\n",sizeof(int));
printf("float takes %d byte \n",sizeof(float));
printf("Double takes %d byte",sizeof(double));
 getch();
}

Output

Data Type With C/C++ Language  Image



Remarks

Here we have used sizeof keyword to know the size of data type and we can see the corresponding output.
 

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum