Ticker

6/recent/ticker-posts

Header Ads Widget

Responsive Advertisement

Data type in C programming language

Data type in C programming language Here we divide the data into four main sections. They are as follows
  1. Basic Data Type ( Ex- int, char, float, double )
  2. Derived Data Type ( Ex- array, pointer, structure, union )
  3. Enumeration Data Type ( Ex- enum )
  4. Void Data Type ( Ex- void )

Basic Data Type

Signed and unsigned vocabulary can be understood in C programming language. The basic bases of basic data types are built on integers and floating data types. Basic Data Types 32-bit or 64-bit operating systems have different memory sizes. The following is the amount of memory required for a 32 bit operating system.

Data Types

Memory Size

Value range

Format Specifier

char

1 byte

−128 to 127

 

signed char

1 byte

−128 to 127

%c

unsigned char

1 byte

0 to 255

%c

short

2 bytes

−32,768 to 32,767

 

signed short

2 bytes

−32,768 to 32,767

%hi

unsigned short

2 bytes

0 to 65,535

%hu

int

2 bytes

−32,768 to 32,767

 

signed int

2 bytes

−32,768 to 32,767

%d. %i

unsigned int

2 bytes

0 to 65,535

%u

long int

4 bytes

-2,147,483,648 to 2,147,483,647

 

signed long int

4 bytes

-2,147,483,648 to 2,147,483,647

%lli, %lld

unsigned long int

4 bytes

0 to 4,294,967,295

%llu

float

4 bytes

1.2E-38 to 3.4E+38

%f

double

8 bytes

2.3E-308 to 1.7E+308

%lf

long double

10 bytes

3.4E-4932 to 1.1E+4932

%Lf

 

 

 

 

 

 

 

 

 

















int

Integers can consist of zero, positive and negative values. But should not be decimal. You can use this for the integer variable.
 Ex. A student ID number, customer age
int student_ID, intcustomer_age;

Float and Double

Uses float and double to enter any real number. You can think of almost any mathematical number as a real number. That means you can add whole numbers, logical numbers, irrational numbers to this. But we cannot add imaginary numbers to this.
 Ex. - 0, 1, 2, 3, 4,  3/4, 0.125, 0.333

The main difference between Claude and Double is their size. That is, double  includes 8 bytes and float has 4 bytes. Larger real numbers can be used for doubles and smaller real numbers can be added for floats. There are a maximum of six decimal places that can be entered for float.
float salary, iteam_price;
double speed_of_light;

char

The char keyword is used to enter character type variables.
char test = 'K';
If you have any different idea please leave a comment below and we can discuss it.

Post a Comment

0 Comments