0% found this document useful (0 votes)
6 views3 pages

Unit-3 Storage Classes

The document discusses storage classes in programming, including automatic, register, static, and external storage classes. It explains how these classes affect variable attributes and memory allocation, with examples demonstrating their usage. The content highlights the importance of understanding storage classes for efficient programming and variable management.

Uploaded by

anantwork1997
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Unit-3 Storage Classes

The document discusses storage classes in programming, including automatic, register, static, and external storage classes. It explains how these classes affect variable attributes and memory allocation, with examples demonstrating their usage. The content highlights the importance of understanding storage classes for efficient programming and variable management.

Uploaded by

anantwork1997
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Sterage Classes

classes allos wy te chauge some attibutes t


Stoage
variablee aud fuctiens.
-’ Cau chaye exteut ol a vauiable
proga
’Cau Nestict avadablo o a fuuctien toa single

negister
staic
extern
data tye vaniable-namintialvalu]
Sgrdx: stvaragclan
DAuto Steag Clas
autematically created coheu ucten is
-Ate niabla is semeved coheu fuctien is teminated.
Called aud automatically
storage clan for local aia bles.
-De<ault aute nt aj int a;

Registen Storage lass a CPU egister fo


Tequest to cenpilo te ue
By using t, e
(RAM) allbcatien.
Uaniable dtead stack are heavilg (frequaty)
auce -or vaiable that
- Improse prform
ed.
ddress egister iable uy Negiste de
- Cannet take
ce cat
net hawe addresses. mee
egicter int a1;
(
3) Stote storage Ctam vanablo to static.
exteut ol a local
Osed o 0naae vaniable fona pantculaa
-Used to etain value d a
fuuctie call.
<stdio h> Vaolo
Examale> tt include /Global
h a=lo,
tt inctudo <stdio t
1761d hikeC);
vad hike();
Ded mainC)
1beld mun C ) ILocalVaiable lpintt(a=%din a);
iut q= 10; hikeC);
printt("a= lhd n", a); prindf('a=%dn,a);
ike l);
hikeC;
printf("a= 7d n,a); bod hike()
qhike); puntt ('a=%d 1na):
Ueid hike () a+t)
l/Static Vaiabl
static iut a= 1o;
pintf ('a=%d n", a)
att)
Outhut- a= 1o
a-lo
Outt a= 10 a=l1

a= 11
a- l1
a= 11
4) Exterm Sterage lasses
te in fom te comilor thata vaniable i's declaned
- Used
another c-fle)
du Som external file
-Prog1am Example
Ale2.c
# include <stio.h>
t price = loo ;
ijt
13eid hikeC)
extem int pice ;
exten ued hike O) puce t t)
iut main ()
Lpindf(°Pice =d n' price);
Aike();
potf ("ice=hd \n' pice);
eton o;

Output bice =loo


Pice= lo l

You might also like