DATA TYPE IN C LANGUAGE

Data type program में use होने वाले data के type को specify करता है और यह बताता है कि data program के लिये memory में कितनी size occupy करेगा ।|


predefine /fundamental /basic :- predefine define data टाइप एक ऐसा डाटा टाइप होता है जो की c के compiler में पहले से available होता है इसे built in data type भी कहते हैं।

user define data type :- user define data type को user के द्वारा specific purpose के लिये बनाया जाता है ।

derived data type :-  derived data type एक ऐशां data होता हैं जो कि predefine data type से मिलकर बनता है यह predefine data type का derived form होता है ।

Predefine/fundamental              user defined               derived

            int                                      struct                       array
            char                                   union                       function
            float                                   enum                        pointer
            double                               typedef      

  void


कौन सा data type कितना memory occupy करता है इसे हम नीचे दिये गये chart से समझ सकते हैं ।



Declaration of  predefine  data type

Syntax:-

Data type variable name= value;

int a;

int a=5;

singed char ch=’a’;

singed char name;

unsigned char name1;

short unsigned int b;

signed int c;

unsigned int d;

long signed int e;

long unsigned int f;

float f;

double d;

long double range;

declaration of user define data type

structure

struct<structure name>
{
structure element1;
structure element2;
structure element3;
------------------------
------------------------
};
struct <structurename> variable name;

union

union<union name>
{
union element1;
union element2;
union element3;
------------------------
------------------------
};
union <union name> variable name;

enum
enum weekname
{
sun, mon, tue, wed, thu, fri, sat
};
enum weeknmae a1,a2;

typedef

typedef long int NUMBER;
NUMBER var1,var2;

declaration of derived data type

pointer

syntax:-
data type pointer variable name;
int *a;

array

syntax:-
datatype array name[ size];
int arr[10];

function
syntax:-
data type function name (parameter);

void fun1();



some example of data type

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();

int a;

singed char b =’a’;

singed char c;

unsigned char d;

short unsigned int e;

signed int f;

unsigned int g;

long signed int h;

long unsigned int i;

float j;

double k;

long double l;

// char
scanf("%c%c",&c,&d);
printf("%c%c\n",c,d);

//int
scanf("%d%d%ld%lu",&a,&f,&h,&i);
printf("%d%d%ld%lu\n",a,f,h,i);

 //float
scanf("%f",&j);
printf("%f\n",j);

//double

scanf("%lf",&k);
printf("%f\n",k);

// long double

scanf("%lf",&l);
printf("%f\n",l);

getch();
}


English translation

-------------------------------------------------------------------------------------

DATA TYPE

The data type specifies the type of data to be used in the program and tells how much size the memory will occupy for the data program.

predefine / fundamental / basic: - predefine define data type is a data type that is already available in the compiler of c it is also called built in data type.

user define data type: - user define data type is created by the user for specific purpose.

derived data type: - The derived data type is a data consisting of predefine data type, it is the derived form of predefine data type.










Which data type occupies how much memory can we understand from the chart given below.










Declaration of data type

Syntax:-

Data type variable name= value;

int a;

int a=5;

singed char =’a’;

singed char name;

unsigned char name1;

short unsigned int b;

signed int c;

unsigned int d;

long signed int e;

long unsigned int f;

float f;

double d;

long double range;

declaration of user define data type

structure

struct<structure name>
{
structure element1;
structure element2;
structure element3;
------------------------
------------------------
};
struct <structurename> variable name;

union

union<union name>
{
union element1;
union element2;
union element3;
------------------------
------------------------
};
union <union name> variable name;

enum
enum weekname
{
sun, mon, tue, wed, thu, fri, sat
};
enum weeknmae a1,a2;

typedef

typedef long int NUMBER;
NUMBER var1,var2;

declaration of derived data type

pointer

syntax:-
data type pointer variable name;
int *a;

array

syntax:-
datatype array name[ size];
int arr[10];

function
syntax:-
data type function name (parameter);

void fun1();



some example of data type

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();

int a;

singed char b =’a’;

singed char c;

unsigned char d;

short unsigned int e;

signed int f;

unsigned int g;

long signed int h;

long unsigned int i;

float j;

double k;

long double l;

// char
scanf("%c%c",&c,&d);
printf("%c%c\n",c,d);

//int

scanf("%d%d%ld%lu",&a,&f,&h,&i);
printf("%d%d%ld%lu\n",a,f,h,i);

 //float
scanf("%f",&j);
printf("%f\n",j);

//double

scanf("%lf",&k);
printf("%f\n",k);

// long double

scanf("%lf",&l);
printf("%f\n",l);

getch();

}