Storage Classes
C language supports four storage class specifiers:
(1) extern
(2) static
(3) register
(4) auto
These storage specifiers inform the compiler how to store the subsequent variable.
Syntax:
storage_specifier type var_name;
1)extern:
- extern storage specifier is used for informing the compiler that the variable is defined as an extern, i.e., it is declared elsewhere.
- extern is only used to give a reference of a global variable.
- The variables that are declared as extern does not allocate any memory, and it is only a declaration.
- extern variable can only be initialized globally, i.e., it cannot be initialized within a method or any block.
- It can be declared multiple times but can be initialized only once.
2)Static:
- The variables declared as static preserves their value even after they are out of their scope.
- We can say that extern variables are initialized only once but exist till the termination of the program.
- The scope of extern variables is local to the function to which they are defined.
3)Register:
- The register specifier is similar to auto except that it is used to request the compiler to keep the value of a variable in a CPU register, i.e., unlike standard variables, it is not stored in memory.
- This makes the operations on a register variable faster than on a standard variable because the register variable was held in the CPU. It does not require memory access to determine or modify its value.
4)Auto:
- The variables declared as auto are allocated automatically at runtime in the memory.
- The visibility of the auto variables is restricted to the block in which it is defined.
- The keyword auto is rarely used in programs because the auto is the default storage class for the variables declared in the function or block.
- The automatic variables are initialized by default to garbage.
Who is the course for?
- This course is designed for the students, employees, software programmers who want to learn C programming from scratch to end.
- After successfully completing this course you will be able to understand how the programming works and use it in the real time environment.
Prerequisites before starting this course:
- Before entering into this course you should have the basic understanding of how computer technology works.
- If you don’t have any experience in C or any other programming language then this course is for you.
- If your intermediate level of knowledge in C programming and you want to enhance your C skills to advance level then this course is for you.
- All you need is just any of the one device mobile, laptop, or PC and internet connection.
Questions 🙵 Answers.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eu orci faucibus orci malesuada semper eget non tellus. Cras sed dignissim purus. Mauris varius neque leo, eu pellentesque justo venenatis et. Sed ultricies risus non turpis tempus, nec nulla suscipit. In comdo urna eu turpis accumsan, et viverra mauris fringillaCras interdumÂ
Video 48 Min + 2 Min read to complete
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eu orci faucibus orci malesuada semper eget non tellus. Cras sed dignissim purus. Mauris varius neque leo, eu pellentesque justo venenatis et. Sed ultricies risus non turpis tempus, nec nulla suscipit. In comdo urna eu turpis accumsan, et viverra mauris fringillaCras interdumÂ
Video 48 Min + 2 Min read to complete
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eu orci faucibus orci malesuada semper eget non tellus. Cras sed dignissim purus. Mauris varius neque leo, eu pellentesque justo venenatis et. Sed ultricies risus non turpis tempus, nec nulla suscipit. In comdo urna eu turpis accumsan, et viverra mauris fringillaCras interdumÂ
Video 48 Min + 2 Min read to complete
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eu orci faucibus orci malesuada semper eget non tellus. Cras sed dignissim purus. Mauris varius neque leo, eu pellentesque justo venenatis et. Sed ultricies risus non turpis tempus, nec nulla suscipit. In comdo urna eu turpis accumsan, et viverra mauris fringillaCras interdumÂ
Video 48 Min + 2 Min read to complete
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eu orci faucibus orci malesuada semper eget non tellus. Cras sed dignissim purus. Mauris varius neque leo, eu pellentesque justo venenatis et. Sed ultricies risus non turpis tempus, nec nulla suscipit. In comdo urna eu turpis accumsan, et viverra mauris fringillaCras interdumÂ
Video 48 Min + 2 Min read to complete