Geschrieben von Student*innen, die bestanden haben Sofort verfügbar nach Zahlung Online lesen oder als PDF Falsches Dokument? Kostenlos tauschen 4,6 TrustPilot
logo-home
Notizen

Computer system

Bewertung
-
Verkauft
-
seiten
30
Hochgeladen auf
24-07-2023
geschrieben in
2017/2018

Computer system, computer science, computer skills, computer language

Hochschule
Kurs

Inhaltsvorschau

assumed as auto and stored in the memory. When a variable is declared as register, it is stored
in the CPU registers. The default value of the variable will be garbage value. Scope of the
variable within the block where it is defined and the life of the variables is until the control
remains within the block.

Register variable has faster access than normal variable. Frequently used variables are kept in
register. Only few variables can be placed inside register.

NOTE : We can't get the address of register variable

Sytax : register data_type variable_name;

Ex: register int i;

Ex : void demo(); OUTPUT

void main() 20

{ 20

demo(); 20

demo();

demo();

}

void demo()

{

register int i=20;

printf(“%d\n”,i);

i++;

}

3 : Static Storage class : When a variable is declared as static, it is stored in the memory. The
default value of the variable will be zero. Scope of the variable is within the block where it is
defined and the life of the variable persists between different function calls. To define a variable
as static storage class, the keyword „static‟ is used. A static variable can be initialized only
once, it cannot be reinitialized.

Syntax : static data_type variable_name;


C PROGRAMMING Page 161

, Ex: static int i;

Ex : void demo(); OUTPUT

void main() 20

{ 21

demo(); 22

demo();

demo();

}

void demo()

{

static int i=20;

printf(“%d”,i);

i++;

}



4 : External Storage class : When a variable is declared as extern, it is stored in the memory.
The default value is initialized to zero. The scope of the variable is global and the life of the
variable is until the program execution comes to an end. To define a variable as external storage
class, the keyword „extern‟ is used. An extern variable is also called as a global variable.
Global variables remain available throughout the entire program. One important thing to
remember about global variable is that their values can be changed by any function in the
program.



Systax : extern data_type variable_name;

extern int i;



Ex:


C PROGRAMMING Page 162

, int number;

void main()

{

number=10;

}

fun1()

{

number=20;

}

fun2()

{

number=30;

}

Here the global variable number is available to all three functions.




Ex : void fun1();

void fun2();

int e=20;

void main()

{

fun1();

fun2();

}

void fun1()


C PROGRAMMING Page 163

Schule, Studium & Fach

Studien-Niveau
Herausgeber
Fach
Kurs

Dokument Information

Hochgeladen auf
24. juli 2023
Anzahl der Seiten
30
geschrieben in
2017/2018
Typ
Notizen
Professor(en)
Prof
Enthält
Alle klassen

Themen

13,06 €
Vollständigen Zugriff auf das Dokument erhalten:

Falsches Dokument? Kostenlos tauschen Innerhalb von 14 Tagen nach dem Kauf und vor dem Herunterladen kannst du ein anderes Dokument wählen. Du kannst den Betrag einfach neu ausgeben.
Geschrieben von Student*innen, die bestanden haben
Sofort verfügbar nach Zahlung
Online lesen oder als PDF

Lerne den Verkäufer kennen
Seller avatar
akhilagouri

Lerne den Verkäufer kennen

Seller avatar
akhilagouri A Level Notes
Folgen Sie müssen sich einloggen, um Studenten oder Kursen zu folgen.
Verkauft
-
Mitglied seit
2 Jahren
Anzahl der Follower
0
Dokumente
107
Zuletzt verkauft
-

0,0

0 rezensionen

5
0
4
0
3
0
2
0
1
0

Kürzlich von dir angesehen.

Warum sich Studierende für Stuvia entscheiden

on Mitstudent*innen erstellt, durch Bewertungen verifiziert

Geschrieben von Student*innen, die bestanden haben und bewertet von anderen, die diese Studiendokumente verwendet haben.

Nicht zufrieden? Wähle ein anderes Dokument

Kein Problem! Du kannst direkt ein anderes Dokument wählen, das besser zu dem passt, was du suchst.

Bezahle wie du möchtest, fange sofort an zu lernen

Kein Abonnement, keine Verpflichtungen. Bezahle wie gewohnt per Kreditkarte oder Sofort und lade dein PDF-Dokument sofort herunter.

Student with book image

“Gekauft, heruntergeladen und bestanden. So einfach kann es sein.”

Alisha Student

Häufig gestellte Fragen