Data Types in C in Hindi - Different type of data type in C
C

Data Types in C in Hindi – Different type of data type in C

Data Types in C. इस tutorial में हम Data types के बारे में सीखेंगे और ये भी सीखेंगे की data type कितने प्रकार के होते हैं और C programming में variable कैसे declare करते हैं? In this tutorial, we will learn about data type and types of data type? We will also learn how to declare variable in C programming? Let’s start.

Data types in C

C programming में variable और function को इस्तेमाल करने से पहले उसे declare करना होता है|

Data type, variable और function के type और nature को specify करता है की ये किस प्रकार के data को store कर सकते हैं और कितना मेमोरी occupies करेंगे मतलब की data type किसी भी variable के type को specify करता है की यह variable memory location में कितना space occupy करेगा और यह किस प्रकार के data को store करेगा|

Types of Data Type in C

C programming में Data Type निम्नलिखित प्रकार के होते हैं जो की निचे दिए गए हैं लेकिन generally data type दो प्रकार के होते हैं Basic data type और derived data type.

  • Basic data type
  • Derived data type
  • Enumerated type
  • Void data type
Data Types in C
Data Types in C

चलिए इन सभी के बारे में एक एक करके details में जानते हैं|

Basic Data Type

यह data type primary data type होता हैं जो computer memory में actual data को represent करता हैं मतलब की कौन सा variable किस size का होगा, कितना मेमोरी occupy करेगा, ये specify करते हैं| Basic data type के अंतर्गत integer, floating-point और char type आते हैं|चलिए सभी के बारे में एक एक करके explain करते हैं|

Integer (int)

Integer data type whole number को store करने के लिए इस्तेमाल किया जाता है यह zero, negative और positive values को store कर सकता है जैसे की 0, 3, 6, -7, -9, -120. यह data type decimal number (दशमलव संख्या) को store नहीं करता है जैसे की 1.2, -2.3

Integer variable को declare करने के लिए int keyword का उपयोग किया जाता है| For example:

int a;

यहाँ पर a एक variable name है जो की integer type का variable है| आप C programming में multiple variable को declare कर सकते हैं| Multiple variable को separate करने के लिए comma का इस्तेमाल किया जाता है| जैसे:

int a, b, c;

Int data type का range -32768 से 32767 या -2147483648 से 2147483647 तक होता है| इसका range अलग अलग operating system के अनुसार होता है| जैसे 32- bit operating system के लिए different range होता है और 64-bit operating system के लिए different range होता है|

अलग अलग प्लेटफार्म पर यानि की अलग अलग operating system पर किसी भी data type और variable का size जानने के लिए आप sizeof operator का इस्तेमाल कर सकते हैं| sizeof आपके variable और data type का size bytes में बताता है| निचे दिए गए program में int type का size पता करने का तरीका बताया गया है| sizeof के द्वारा आप सभी data type का size जान सकते हैं|

#include <stdio.h>

int main() {
   printf("Size of int type in bytes : %d \n", sizeof(int));
   
   return 0;
}

जब आप इस program को compile और execute करायेंगे तो यह program आपको आपके operating system के architecture के अनुसार output देगा| मेरा operating system 64-bit architecture का है इसलिए यह 4 bytes answer provide कर रहा है|

Size of int type in bytes : 4

निचे दिए गए table में integer और character type के size और range के बारे में बताया गया है|

TypeStorage SizeRange
char1 byte-128 to 127 or 0 to 255
unsigned char1 byte0 to 255
signed char1 byte-128 to 127
int2 bytes or 4 bytes-32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
unsigned int2 bytes or 4 bytes0 to 65,535 or 0 to 4,294,967,295
short2 bytes-32,768 to 32,767
unsigned short2 bytes0 to 65,535
long4 bytes-2,147,483,648 to 2,147,483,647
unsigned long4 bytes0 to 4,294,967,295

Floating-point types

Floating-point types का उपयोग real number को store करने के लिए किया जाता है जैसे की 5.02, 5.364, -5.012 इस type के अंतर्गत float, double और long double data type आते हैं| Float data type का size 4 bytes होता है, double data type का size 8 bytes होता है जबकि long double data type का size 10 bytes होता है| तीनो types अलग अलग प्रकार के precision को store करके रखते हैं| Precision का मतलब दशमलव के बाद अंक|

निचे दिया गया table floating-point number के type, range, storage size और precision को का details provide करता है|

TypeStorage SizeRangePrecision
float4 bytes1.2E-38 to 3.4E+386 decimal places
double8 bytes2.3E-308 to 1.7E+30815 decimal places
long double10 bytes3.4E-4932 to 1.1E+493219 decimal places

char

char एक single character को store करने के लिए इस्तेमाल किया जाता है| Single character को single quote के अन्दर लिखा जाता है| character type के variable को define करने के लिए char keyword का उपयोग किया जाता है| Character variable का size 1 byte होता है|जिसका range -128 से 127 या 0 से 255 तक होता है|

declaration of character type variable:

char first =’a’;

Derived data type in C

Derived data type का इस्तेमाल primary data type की मदद के द्वारा किया जाता है इसलिए इसे derived data type कहा जाता है| सभी derived data type के बारे में हम अलग अलग tutorial में सीखेंगे|

  • Array type
  • Pointer Type
  • Structure type
  • Union type

Void Data Type in C

void data type किसी भी प्रकार का value return नहीं करता है मतलब की यह no value available को specify करता है|जब हमें function से किसी भी प्रकार का value return नहीं करवाना होता है तो हम उस function का type void specify कर सकते हैं|

एक बात का हमेशा ध्यान रखें की आप void type का variable declare नहीं कर सकते|

Conclusion and Final Words

इस tutorial में हमें सीखा की C में data types क्या होता है? C programming में data type कितने प्रकार के होते हैं? Variable कैसे declare करते हैं? What is data types in C? How many types of data types in C programming? How to declare variable in C?

इस tutorial में जो topic के बारे में नहीं बताया गया है उस topic के बारे में हम उन सभी topics के respective tutorial में उनका definition जानेंगे|

ये भी पढ़ें:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments