What is Data type and types of data type?

इस article में हम  Data type and types of data type   को सरल व आसान भाषा में जानेंगे ..
तो चलिए start करते हैं……


Data type:-

c language में data type  दो प्रकार के होते हैं|


(1) primary data type:-

primary data types के चार प्रकार होते हैं

 

(¡) integer:-

इसमें दशमलव के अलावा बाकी सभी संख्याएं आती हैं।
Integer define करने के लिए int शब्द का यूज़ होता है
Ex- int a =5; 


(¡¡) float:-

दशमलव वाली संख्याएं float में define की जाती है। float में integer का मान भी define होता हैं। 
किसी संख्या को float में define करने के लिए float शब्द का use किया जाता हैं।
Ex- float a =5.2;


(¡¡¡) character:-

c language में single alfabate को define करने के लिए character का use होता है।
जिसे char से दर्शाया जाता हैं। तथा उस character को ”( सिंगल कोष्टक) में डाला जाता हैं।
Ex:- char ‘x’


(¡v) string:-

characters का समूह  string कहलाता हैं।  इसको define करने के लिए string  शब्द का प्रयोग किया जाता है। तथा string को double quote ” ” में डाला जाता हैं।
Ex:- string “neeraj”


इसे भी देखे:


(2) Secondary data type:- 

                             c language में secondary data type चार प्रकार के होते हैं।

(A) Array :-

 groups of same items ” समान items का समूह array कहलाता है”
Ex:-{1,2,3,4,5,6,7,8,9,}

‘C’ language में जब कभी भी data type define करना हो तो उन्हें अलग अलग ना define करके array बनाया जाता हैं।



(B) structure and union:-  

यह items का समूह है जिसके अन्दर विभिन्न प्रकार के data type define किये जा सकते है
Structure बनाने के लिए struct शब्द का use किया जाता है । तथा union , union शब्द लिखकर हि बनाये जाते हैं।

Ex-
struct class it
{
Int roll no;// 2byte
Char c;// 1byte
Int pincode;//2byte
};
Total= 5
Union class it
{
Int roll no;//2 byte
Char c;//1byte
Int pincode;// 2byte
};
Total= 2
Note:-  structure & union  के बीच एक प्रमुख अन्तर है। memory allocation .
(1) structure का मेमोरी allocation करने पर total मेमोरी bytes में होगी ।
(2) union का memory allocation करने पर इस्तेमाल मेमोरी bytes होगी
 पॉइंटर वह variable है जो कि दूसरें variable के address को contain किये रहता है.
  अगर हम int=3; इस प्रकार का declaration करते है। तो c compiler memory में एक block बनाता है। जिसमे i= location name ,3 उस location की value है तथा memory में  एक location number होता है। जिसे memory address भी कहते हैं। 
i=  location name
3= values
6485= memory address


  • निवेदन:- अगर आपके लिए यह आर्टिकल useful रहा हो तो इसे अपने दोस्तों और classmates के साथ अवश्य share कीजिये,

    या अन्य विषयों से related कोई question हो तो नीचे कमेंट के द्वारा बताइए. thanks

Leave a Comment