સી ભાષા માં ડેટા ટાઈપ ખુબજ મહત્વ ધરાવે છે. ડેટા ટાઈપ એ નક્કી કરે છે કે વેરીયેબલ  કે ફંકશન કઈ રીત (ટાઈપ) ની કીમત પછી આપશે કે ફંક્શન માં કઈ ટાઈપ ના પેરામીટર ( જે ફંક્શન માંથી પસાર થાય તે ) હશે.

 

c-Data-Types

 

Primitive Data Types :

તેમાં નીચે મુજબ ના ડેટા ટાઈપ નો સમાવેશ થાય છે.

 

Data Type keyword Description
Integer Data Type int  નંબર વાલી માહિતી દર્શાવે (point વગર)
Float Data Type float  નંબર વાલી માહિતી દર્શાવે (point સાથે )
Character Data Type char એક અક્ષર વાલી માહિતી દર્શાવે
Long Data Type long લાંબા નંબર વાલી માહિતી દર્શાવે (point વગર)
Double Data Type double લાંબા નંબર વાલી માહિતી દર્શાવે (point સાથે)

નીચે ના ટેબલ માં Primitive (પ્રાથમિક) Data Type ની સાઇઝ અને રેન્જ આપેલી છે.

S.No C Data types Size (Bytes) Range
1 char 1 –127 to 127
2 int 2 –32,767 to 32,767
3 float 4 1E–37 to 1E+37 with six digits of precision
4 double 8 1E–37 to 1E+37 with ten digits of precision
5 long double 10 1E–37 to 1E+37 with ten digits of precision
6 long int 4 –2,147,483,647 to 2,147,483,647
7 short int 2 –32,767 to 32,767
8 unsigned short int 2 0 to 65,535
9 signed short int 2 –32,767 to 32,767
10 long long int 8 –(2power(63) –1) to 2(power)63 –1
11 signed long int 4 –2,147,483,647 to 2,147,483,647
12 unsigned long int 4 0 to 4,294,967,295
13 unsigned long long int 8 2(power)64 –1

 

Syntax:

[crayon lang=”c”] DATA_TYPE Variable_Name;[/crayon]

ઉદાહરણ :
[crayon lang=”c”]

int a;

int b=5;

float c=5.66;

double=5.8888888

char ch;

[/crayon]

 

Void ડેટા ટાઇપ :

Void ડેટા ટાઈપ ત્યારે વપરાય છે જયારે ફંક્શન કોઈ કિંમત પછી ના આપતું હોય , Void  દર્શાવે છે કે તે  NULL (ખાલી) છે. જયારે Return Type ખબર ના હોય જેવા કિસ્સા માં પણ Void વપરાય છે.

ઉદાહરણ:
[crayon lang=”c”]
#include
void sayhello(void);

main()

{

/* say hello here */

sayhello();

}

/* Function. */

void sayhello(void)

{
printf(“Welcome to GujjuGEEK\n”);
}
[/crayon]

Output:

output

 

બાકી ના ડેટા ટાઈપ્સ આપણે સ્વતંત્ર મુદ્દા માં જોઈશું.

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here