Header Ads

Datatypes in C Language

 Datatypes in C Language

In the C programming language, data types are used to define the type of data that a variable can store. Each data type has a specific range of values and operations that can be performed on it. Here are the basic data types in C:

1. int: It represents integers, which are whole numbers without decimal points. The size of an int depends on the platform, but it is typically 4 bytes.

2. float: It represents floating-point numbers, which are numbers with decimal points. They are used to store real numbers. The size of a float is typically 4 bytes.

3. double: It is similar to float but provides higher precision. Double is used to store double-precision floating-point numbers, which have a larger range and higher precision than float. The size of a double is typically 8 bytes.

4. char: It represents a single character. It is used to store individual characters like letters, digits, or special symbols. The size of a char is typically 1 byte.

5. short: It represents a short integer. It is used to store smaller integers than int, but it takes less memory. The size of a short is typically 2 bytes.

6. long: It represents a long integer. It is used to store larger integers than int. The size of a long can vary across different platforms but is typically 4 bytes or 8 bytes.

7. _Bool: It represents a Boolean value, which can be either true or false. The size of _Bool is typically 1 byte.

8. void: It is a special data type that indicates the absence of a type. It is commonly used as a return type for functions that do not return a value or as a placeholder for generic pointers.

These are the basic data types in C. Additionally, C also provides modifiers like unsigned and signed to specify the range and sign of a data type. For example, unsigned int represents only non-negative integers, while signed int can represent both positive and negative integers.


हिंदी:

C प्रोग्रामिंग भाषा में, डेटा टाइप्स का उपयोग चर में एक वेरिएबल के द्वारा संग्रहीत डेटा के प्रकार की परिभाषा करने के लिए किया जाता है। प्रत्येक डेटा टाइप के पास एक निर्दिष्ट मानों और संचालनों का एक विशेष सीमा होती है। यहां C में मूल डेटा टाइप्स हैं: 1. int: यह पूर्णांकों को प्रतिष्ठित करता है, जो दशमलव अंकों के बिना पूर्णांक होते हैं। एक इंट का आकार प्लेटफ़ॉर्म पर निर्भर करता है, लेकिन आमतौर पर यह 4 बाइट्स होता है। 2. float: यह फ्लोटिंग-पॉइंट नंबर को प्रतिष्ठित करता है, जो दशमलव अंकों के साथ संख्याएँ होती हैं। वे वास्तविक संख्याओं को संग्रहीत करने के लिए उपयोग होते हैं। एक फ़्लोट का आकार आमतौर पर 4 बाइट्स होता है। 3. double: यह float के बराबर है, लेकिन इसमें अधिक सटीकता होती है। डबल का उपयोग डबल-सटीकता फ्लोटिंग-पॉइंट नंबर को संग्रहीत करने के लिए किया जाता है, जिसमें फ़्लोट से अधिक सीमा और अधिक सटीकता होती है। एक डबल का आकार आमतौर पर 8 बाइट्स होता है। 4. char: यह एकल वर्ण को प्रतिष्ठित करता है। इसका उपयोग व्यक्तिगत वर्णों को संग्रहीत करने के लिए किया जाता है जैसे पत्र, अंक या विशेष प्रतीक। एक चार का आकार आमतौर पर 1 बाइट होता है। 5. short: यह एक छोटा पूर्णांक को प्रतिष्ठित करता है। इसका उपयोग int से छोटे पूर्णांकों को संग्रहीत करने के लिए किया जाता है, लेकिन यह कम मेमोरी लेता है। एक शॉर्ट का आकार आमतौर पर 2 बाइट्स होता है। 6. long: यह एक लंबा पूर्णांक को प्रतिष्ठित करता है। इसका उपयोग int से बड़े पूर्णांकों को संग्रहीत करने के लिए किया जाता है। एक लॉंग का आकार विभिन्न प्लेटफ़ॉर्म्स पर अलग-अलग हो सकता है, लेकिन आमतौर पर यह 4 बाइट्स या 8 बाइट्स होता है। 7. _Bool: यह बूलियन मान को प्रतिष्ठित करता है, जो केवल सच या झूठ हो सकता है। _Bool का आकार आमतौर पर 1 बाइट होता है। 8. void: यह एक विशेष डेटा टाइप है जो एक टाइप की अनुपस्थिति को दर्शाता है। यह आमतौर पर वापसी टाइप के रूप में उपयोग किया जाता है जब कोई मान नहीं लौटाता है या जनेरिक पॉइंटर्स के लिए एक स्थानप्राप्ति के रूप में। ये सी में मूल डेटा टाइप्स हैं। इसके अलावा, सी भी अवयव जैसे unsigned और signed प्रदान करता है, जो एक डेटा टाइप की सीमा और संकेत को निर्दिष्ट करने के लिए उपयोग किए जाते हैं। उदाहरण के लिए, unsigned int केवल नकारात्मक पूर्णांकों को प्रतिष्ठित करता है, जबकि signed int सकारात्मक और नकारात्मक पूर्णांकों दोनों को प्रतिष्ठित कर सकता है।

No comments

Powered by Blogger.