Data Types

Understanding Data Types in C Programming

Introduction to Data Types (डेटा टाइप्स का परिचय)

Data types define करते हैं कि variable किस प्रकार का data store कर सकता है और उस पर कौन से operations perform किए जा सकते हैं।

Data types define what kind of data a variable can store and what operations can be performed on it.

Key Points (मुख्य बिंदु):

  • C में data types को दो main categories में divide किया जाता है: Basic और Derived
  • In C, data types are divided into two main categories: Basic and Derived
  • Basic data types directly supported होते हैं language द्वारा
  • Basic data types are directly supported by the language
  • Derived data types basic types से construct किए जाते हैं
  • Derived data types are constructed from basic types

Basic Data Types (मूल डेटा टाइप्स)

C में मुख्य basic data types:

Main basic data types in C:

Data Type (डेटा टाइप) Description (विवरण) Example (उदाहरण)
int Integer values store करता है int age = 25;
int Stores integer values int age = 25;
float Single precision floating point values float pi = 3.14;
float Single precision floating point values float pi = 3.14;
double Double precision floating point values double pi = 3.14159;
double Double precision floating point values double pi = 3.14159;
char Single character store करता है char grade = 'A';
char Stores a single character char grade = 'A';
// Basic data type examples
int number = 42;          // Integer
float temperature = 98.6; // Single precision float
double pi = 3.14159;     // Double precision float
char letter = 'A';       // Character

Size and Range (साइज़ और रेंज)

Different data types का size और range:

Size and range of different data types:

Data Type (डेटा टाइप) Size (बाइट्स) Range (रेंज)
char 1 -128 to 127
char 1 -128 to 127
int 4 -2,147,483,648 to 2,147,483,647
int 4 -2,147,483,648 to 2,147,483,647
float 4 1.2E-38 to 3.4E+38
float 4 1.2E-38 to 3.4E+38
double 8 2.3E-308 to 1.7E+308
double 8 2.3E-308 to 1.7E+308

Type Modifiers (टाइप मॉडिफायर्स)

Type modifiers data types के range और size को modify करते हैं:

Type modifiers modify the range and size of data types:

// Type modifier examples
signed int positive = 100;    // Can store both positive and negative
unsigned int count = 50;      // Can store only positive
short int small = 10;         // Smaller range
long int big = 1000000;       // Larger range
long double precise = 3.14159; // More precise
  • signed: Positive और negative दोनों values store कर सकता है
  • signed: Can store both positive and negative values
  • unsigned: केवल positive values store कर सकता है
  • unsigned: Can store only positive values
  • short: Memory space को reduce करता है
  • short: Reduces memory space
  • long: Range को increase करता है
  • long: Increases the range
  • Best Practices (सर्वोत्तम प्रथाएं)

    Data types के साथ काम करने के best practices:

    Best practices for working with data types:

  • Appropriate Type Selection: Data के according सही type choose करें
  • Appropriate Type Selection: Choose the right type according to data
  • Memory Efficiency: Memory usage को optimize करें
  • Memory Efficiency: Optimize memory usage
  • Type Safety: Type conversion को carefully handle करें
  • Type Safety: Handle type conversion carefully
  • Documentation: Variable types को clearly document करें
  • Documentation: Clearly document variable types