storage classes in c in hindi tutorial complete guide

utnantifferenti storage classes in C is a crucial concept that every programmer should understand to make their code efficient and organized. Let's dive into the world of storage classes in C with this comprehensive guide in Hindi.

Storage Class in C Language की जानकारी हिन्दी में
Storage Class in C Language की जानकारी हिन्दी में

In C, storage classes determine the lifetime and scope of variables. They dictate where and how the variable is stored in memory. There are four primary storage classes in C: automatic, external, static, and register. Let's explore each one in detail.

What is Computer Storage Device | Basic Beginners Training Class No 5 Urdu / Hindi | Lecture No 5
What is Computer Storage Device | Basic Beginners Training Class No 5 Urdu / Hindi | Lecture No 5

Automatic Storage Class

The automatic storage class, also known as the local storage class, is the most common type of variable declaration in C. These variables are stored on the stack, and their lifetime is limited to the duration of the function in which they are declared.

Learn C language in 30 Minutes & Start Coding For Beginners in Hindi
Learn C language in 30 Minutes & Start Coding For Beginners in Hindi

autologous variables are initialized every time the function is called. If not initialized, they are allocated unspecified values. Here's an example:

Automatic Variables Initialization

Preposition in hindi
Preposition in hindi

Automatic variables are initialized every time the function is called. If not initialized, they are allocated unspecified values. Here's an example:

```c void function() { int i; float f; char c; // Variable i, f, and c are automatic variables // They are automatically initialized when the function is called printf("Uninitialized Variables: i = %d, f = %f, c = %c\n", i, f, c); } ```

Automatic Variables Scope

Clean Code Chapter 10: Classes
Clean Code Chapter 10: Classes

Automatic variables can only be accessed within the function where they are declared. They have function-level scope. Once the function execution is over, the variables are released from the memory.

Here's an example demonstrating the scope of automatic variables:

```c #include void printVariables() { int a = 5; printf("Value of a in printVariables() is: %d\n", a); } int main() { int a = 10; printVariables(); // a is 5 here, not 10 printf("Value of a in main() is: %d\n", a); // a is 10 here return 0; } ```

IBM i, AS400 Tutorial, iSeries, System i -AS/400 basic Introduction for Beginners- Objects & Storage
IBM i, AS400 Tutorial, iSeries, System i -AS/400 basic Introduction for Beginners- Objects & Storage

External Storage Class

The external storage class is used to declare global variables that can be accessed from any function in the program. These variables are stored in the data segment of memory and have external linkage.

the basic english words used in this class are shown on a pink and white background
the basic english words used in this class are shown on a pink and white background
storage classes in c in hindi
storage classes in c in hindi
Learn Daily use English Sentences
Learn Daily use English Sentences
Hindi Basics, Hindi For Beginners, Basic Hindi Words For Kids, Hindi Basics For Beginners, Hindi Worksheets For Class 1, Hindi Worksheet, Hindi Class 1, Word Meaning For Class 1, Worksheet Hindi Grade 1
Hindi Basics, Hindi For Beginners, Basic Hindi Words For Kids, Hindi Basics For Beginners, Hindi Worksheets For Class 1, Hindi Worksheet, Hindi Class 1, Word Meaning For Class 1, Worksheet Hindi Grade 1
Block Diagram of Computer | DTE 1st Year C-Scheme
Block Diagram of Computer | DTE 1st Year C-Scheme
C++ Complete Handbook | Programming & DSA Guide for Students
C++ Complete Handbook | Programming & DSA Guide for Students
Class 8 Science Chapter 12 Question Answer in Hindi प्रकृति कैसे सामंजस्य में कार्य करती है
Class 8 Science Chapter 12 Question Answer in Hindi प्रकृति कैसे सामंजस्य में कार्य करती है
Hindi English Vocabulary Card, Computer Basic, English To Hindi Dictionary, General Knowledge Facts, General Knowledge
Hindi English Vocabulary Card, Computer Basic, English To Hindi Dictionary, General Knowledge Facts, General Knowledge
Learn Java Collections Fast 🚀 | ArrayList HashMap Set Queue Explained
Learn Java Collections Fast 🚀 | ArrayList HashMap Set Queue Explained
the words are in different languages
the words are in different languages
C se meaning
C se meaning
the types of operating systems that are used to help students learn how to use them
the types of operating systems that are used to help students learn how to use them
an english dictionary with many different languages and words in the same language, including one for each
an english dictionary with many different languages and words in the same language, including one for each
Useful 50 Maths words in english and hindi #spokenenglish
Useful 50 Maths words in english and hindi #spokenenglish
English Moral Stories, Shop Banner Design, English Word Book, Gk Questions And Answers, Indian History Facts, English Learning Spoken, English Phrases Idioms, Galaxy Wallpaper Iphone, Math Notebooks
English Moral Stories, Shop Banner Design, English Word Book, Gk Questions And Answers, Indian History Facts, English Learning Spoken, English Phrases Idioms, Galaxy Wallpaper Iphone, Math Notebooks
an image of the words in english on a white background with pink and blue lettering
an image of the words in english on a white background with pink and blue lettering
Mastering C Programming - From Basics to Deep Internals
Mastering C Programming - From Basics to Deep Internals
Furniture in Hindi
Furniture in Hindi
Task Box FAQs
Task Box FAQs
वर्णमाला
वर्णमाला

External variables are defined outside any function, and their lifetime extends the entire execution of the program. If not explicitly initialized, they are allocated zero.

External Variables Initialization

External variables are initialized only once, at the start of the program. If not initialized, they are allocated zero.

```c // File: main.c int a; // Declaration of an external variable float b; // File: anotherFile.c #include "main.h" // Including the header file for main.c void function() { // a and b can be accessed here } ```

External Variables Scope

External variables have file-level scope. They can be accessed from any function in the same file or from external files using the global scope syntax (e.g., globvar).

Here's an example demonstrating the scope of external variables:

```c // File: main.c #include int a = 5; // External variable int main() { printf("Value of a in main() is: %d\n", a); // a is 5 here return 0; } // File: anotherFile.c void printVariable() { printf("Value of a is: %d\n", a); // a is 5 here, can be accessed } ```

Static Storage Class

The static storage class is used to declare local variables that retain their values between function calls. Static variables are stored in the data segment of memory, not on the stack, and have internal linkage.

Static variables can only be declared within functions and are initialized only once, at the start of the program. They have function-level scope and retain their values between function calls.

Static Variables Initialization and Retention

Static variables are initialized only once, at the start of the program. They retain their values between function calls. Here's an example:

```c void counter() { static int count = 0; count++; printf("Count is: %d\n", count); } int main() { counter(); // Prints 1 counter(); // Prints 2 counter(); // Prints 3 return 0; } ```

Static Variables Scope

Static variables have function-level scope. They can only be accessed within the function where they are declared. However, their values are retained between function calls.

Here's an example demonstrating the scope of static variables:

```c void printVariable() { static int a = 5; // a is a static variable printf("Value of a is: %d\n", a); // a is 5 here } ```

Register Storage Class

The register storage class in C is used to suggest that the variable could be stored in a register instead of memory. However, the use of the register keyword does not guarantee that the variable will be stored in a register.

Using the register keyword may improve the performance of the program, as accessing registers is faster than accessing memory. However, using the register keyword too many times can lead to increased compilation time and may not always result in improved performance.

Register Variables Scope

Register variables have the same scope as automatic variables. They are stored in registers if possible, but the actual implementation depends on the compiler.

```c void function() { register int i; // Suggesting that i could be stored in a register // ... } ```

Understanding storage classes in C is crucial for writing efficient and organized code. By carefully choosing the appropriate storage class, you can control the lifetime and scope of your variables, optimizing memory usage and performance. Happy coding!

Related Articles

Storage Classes In C In Hindi Samyak Computer Classes C Scheme Jaipur Cdl A Classes Near Me Upper Division C Classes Csulb Lucknow Coaching Classes Jankipuram Sector G Character Classes D And D Tri C Classes For Adults Don T Burn It Culinary Classes T Ai Chi Classes Near Me Samyak Computer Classes C Scheme