Find the best tutors and institutes for Programming Languages

Find Best Programming Languages Classes

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.


P . akkaiah
29/12/2019 0 0

A storage class defines the scope (visibility) and life-time of variables and/or

functions within a C Program. They precede the type that they modify. We have

four different storage classes in a C program:

  • auto
  • register
  • static
  • extern


The auto Storage Class

The auto storage class is the default storage class for all local variables.


int mount;

auto int month;


The example above defines two variables within the same storage class. ‘auto’

can only be used within functions, i.e., local variables.

The register Storage Class

The register storage class is used to define local variables that should be stored

in a register instead of RAM. This means that the variable has a maximum size

equal to the register size (usually one word) and can't have the unary '&'

operator applied to it (as it does not have a memory location).



register int miles;



The register should only be used for variables that require quick access such as

counters. It should also be noted that defining 'register' does not mean that the

variable will be stored in a register. It means that it MIGHT be stored in a

register depending on hardware and implementation restrictions

The static Storage Class

The static storage class instructs the compiler to keep a local variable in

existence during the life-time of the program instead of creating and destroying

it each time it comes into and goes out of scope. Therefore, making local

variables static allows them to maintain their values between function calls.

The static modifier may also be applied to global variables. When this is done, it

causes that variable's scope to be restricted to the file in which it is declared.

In C programming, when static is used on a class data member, it causes only

one copy of that member to be shared by all the objects of its class.

The extern Storage Class

The extern storage class is used to give a reference of a global variable that is

visible to ALL the program files. When you use 'extern', the variable cannot be

initialized, however, it points the variable name at a storage location that has

been previously defined.

When you have multiple files and you define a global variable or function, which

will also be used in other files, then extern will be used in another file to provide

the reference of defined variable or function. Just for understanding, extern is

used to declare a global variable or function in another file.

The extern modifier is most commonly used when there are two or more files

sharing the same global variables or functions as explained below.

First File:

#include <stdio.h>

int count;

extern void write_extern();



count = 5;



Second File:

#include <stdio.h>

extern int count;

void write_extern(void)


printf("count is %d\n", count);



0 Dislike
Follow 2

Please Enter a comment


Other Lessons for You

Dynamic Memory Allocation in C using malloc()
#include <stdio.h>#include <conio.h>//#include <malloc.h> OR#include <stdlib.h>void main(){ int *ptr, i, n, sum = 0; printf("how many elements ? "); scanf("%d", &n);...

Sankhadeep Pujaru | 04/06/2020

0 0

What is the output of this programming?
#include<stdio.h> main() { printf("%d chennai",+1); }

Asvitha K. | 07/02/2020

1 0

Black in Python
When you are upturn in your career from beginner to experienced in programming world, your team will start looking at ‘how you are writing?’ Here the responsibility piling up. Okay,...

Logeswaran | 31/01/2020

0 0

Be A Python Dev
Currently, in the programming world, Python is one of the languages with a high rising demand profile. And this article will explain why that isn’t slowing down in the foreseeable future.Python...

URIAH Training Center | 18/12/2019

0 1

How to become a self-taught programmer?
In this lesson, I will teach you the step by step process to becoming a self-taught programmer by learning all the programming concepts by yourself with the help of online resources. Step 1: Choose your...

Abraham Paul | 31/10/2019

1 0

Looking for Programming Languages Classes?

Find best tutors for Programming Languages Classes by posting a requirement.

  • Post a learning requirement
  • Get customized responses
  • Compare and select the best

Looking for Programming Languages Classes?

Find best Programming Languages Classes in your locality on UrbanPro

Post your learning requirement

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more