Subject:-Data Structure & Algorithm (Pcc-Cs301) Topic: - Stroge Class in C
Subject:-Data Structure & Algorithm (Pcc-Cs301) Topic: - Stroge Class in C
Subject:-Data Structure & Algorithm (Pcc-Cs301) Topic: - Stroge Class in C
GOVERNMENT ENGINEERING
COLLEGE
SUBJECT :- DATA STRUCTURE & ALGORITHM ( PCC-CS301 )
TOPIC : - STROGE CLASS IN C
SUBMITTED BY ,
RABIN MAHATO
ROLL :- 35000321040
DEPARTMENT :- ECE
REG NO :- 213500100310004
YEAR :- 2ND
SEM :- 3
SEASSION :- 2021-25
INTRODUCTION :-
Storage Classes are used to describe the features of a variable/function. These features basically
include the scope, visibility and life-time which help us to trace the existence of a particular
variable during the runtime of a program.C language uses 4 storage classes, namely
We use the storage class in the C language for determining the visibility, lifetime, initial value,
and memory location of any given variable. The storage classes define the visibility (scope) and
the lifetime of any function/ variable within a C program
Storage Classes are used to describe the features of a variable/function. These features basically
include the scope, visibility and life-time which help us to trace the existence of a particular
variable during the runtime of a program.
C language uses 4 storage classes.
Types of Storage Classes in C
3 .Static 4 .Register
1. Automatic 2. External
Storage Class Storage Class
Storage Class Storage Class
1 . AUTO STROGE CLASS :-
This is the default storage class for all the variables declared inside a function or a block. Hence, the keyword auto
is rarely used while writing programs in C language. Auto variables can be only accessed within the block/function
they have been declared and not outside them (which defines their scope). Of course, these can be accessed within
nested blocks within the parent block/function in which the auto variable was declared. However, they can be
accessed outside their scope as well using the concept of pointers given here by pointing to the very exact memory
location where the variables reside. They are assigned a garbage value by default whenever they are declared.
This storage class declares register variables that have the same functionality as that of the auto variables. The
only difference is that the compiler tries to store these variables in the register of the microprocessor if a free
registration is available. This makes the use of register variables to be much faster than that of the variables
stored in the memory during the runtime of the program. If a free registration is not available, these are then
stored in the memory only. Usually few variables which are to be accessed very frequently in a program are
declared with the register keyword which improves the running time of the program. An important and
interesting point to be noted here is that we cannot obtain the address of a register variable using pointers.
To specify the storage class for a variable, the following syntax is to be followed:Syntax:
storage_class var_data_type var_name;
REFERENCE :-
BOOKS :-
1. Algorithms, Data Structures, and Problem Solving with C++”, Illustrated Edition by
Mark Allen Weiss, Addison-Wesley Publishing Company
3. Expert Data Structures with C, R. B. Patel, Khanna Publishing House, New DelhiRE