You are here: Home / Hindi Web /Topics / Chapter 4 - Introducing C Data types in hindi

Chapter 4 - Introducing C Data types in hindi

Filed under: C Programming Tutorials on 2022-02-28 15:17:26

Introduction to C Data Types 

जब भी आप कोई variable create करते है तो उससे पहले compiler को बताते है की आप किस तरह का data उस variable में store करेंगे। इससे compiler उतनी ही memory उस variable को computer की memory में से allot कर देता है।

/* A Integer type variable */
int age; 

ऊपर दिया गया statement compiler को बताता है की आप age variable में एक whole number (बिना दशमलव के) store करने वाले है। किसी भी whole number को store करने के लिए जितनी memory की आवश्यकता होती है compiler उतनी इस variable को allot कर देता है। जो की 2 bytes है।  

यदि किसी programming language में data types ना हो तो बहुत अधिक memory waste हो सकती है। जब 2 bytes की आवश्यकता हो तब 20 bytes आप waste कर सकते है। इसलिए जितनी भी तरह का data आप store कर सकते है उसके लिए पहले से ही maximum memory limit define की गई है। 

Different C Data Types

C language 3 तरह के data types को support करती है। इन्हें primitive types भी कहते है।

  • Integer Types 
    • int
    • short int
    • long int
    • signed int 
    • unsigned int
  • Floating Point Types 
    • float
    • double
  • Character Types 
    • char

Integer Types

Integer types किसी भी whole number (बिना दशमलव के) को store करने के लिए use किये जाते है। Integer types 5 प्रकार के होते है। हालांकि ये सभी whole numbers को store करते है। लेकिन memory size और range के base पर इन्हें बाँटा गया है।

Data Type

Size (bytes)

 Range 

int 

-32768 से  32767 

short int  

-128 से 127 

long int 

-2,147,483,648 से 2,147,483,647 

signed int (negative values के लिए)

2

-32768 से 32767

unsigned int 

0 से 65535

/* A Long integer type variable */
long int population = 200000000;

Floating Point Types 

Floating point data types को दशमलव संख्याओं को store करने के लिए define किया गया है। Floating point data types 2 तरह के होते है।

Float type में आप दशमलव के बाद 7 digits तक store कर सकते है। Double type में दशमलव के बाद 17 digits तक store की जा सकती है।

 

Data Type

 Size (bytes)

Range 

float  

3.4E-38 से 3.4E+38 

double 

1.7E-308 से 1.7E+308 

 

/* A double type variable */
double balance=810.12354984;

Character Types 

Character types को एक character store करने के लिए use किया जाता है। इनको 2 categories में divide किया गया है। 

Data Type 

Size (bytes)

Range 

char  

-128 से 127  

unsigned char  

0 से 255  

Example

/* A character type variable */
char bestlanguage = “C”; 

Void Type

Void type को उन situation में use किया जाता है जब आपको value के बारे में कोई जानकारी ना हो। इसे functions के साथ ज्यादातर use किया जाता है। 

  1. यदि आपका function कोई value return नहीं करता है तो आप उसका return type void define करते है। उदाहरण के लिए आप इस प्रकार function define कर सकते है। void myFunction();।   
  2. यदि आप function में कोई parameters नहीं ले रहे है तो आप उनकी जगह पर void define कर सकते है। Void type से पता चलता है की इस function में कोई argument नहीं लिया जाता है। इस प्रकार void को parameter के रूप में pass कर सकते है। int myFunction(void);।   
  3. यदि आप निश्चित नहीं है की pointer variable किस type के variable को point करेगा तो आप उसका type void declare कर सकते है। इसके बाद आप void pointer से किसी भी variable को point कर सकते है।
About Author:
M
Madhu     View Profile
Trust everyone but don't trust blindly