100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Class notes

Computer system

Rating
-
Sold
-
Pages
72
Uploaded on
24-07-2023
Written in
2017/2018

Computer system, computer science, computer skills, computer language

Institution
Course











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Study Level
Examinator
Subject
Unit

Document information

Uploaded on
July 24, 2023
Number of pages
72
Written in
2017/2018
Type
Class notes
Professor(s)
Prof
Contains
All classes

Subjects

Content preview

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

, The variables a and b are declared as integer type and auto. The keyword auto is
not mandatory. Because the default storage class in C is auto.

Note: A variable declared inside a function without any storage class specification, is by default
an automatic variable. Automatic variables can also be called local variables because they
are local to a function.



Ex : void function1();

void function2(); OUTPUT

void main() 10

{ 0

int x=100; 100

function2();

printf(“%d”,x);

}

void function1()

{

int x=10;

printf(“%d”,x);

}

void function2()

{

int x=0;

function1();

printf(“%d”,x);

}

2: Register Storage class : To define a variable as register storage class, the keyword
„register‟ is used. If CPU cannot store the variables in CPU registers, then the variables are

C PROGRAMMING Page 160

,Storage Classes
In C language, each variable has a storage class which is used to define scope and life time of a
variable.

Storage: Any variable declared in a program can be stored either in memory or registers.
Registers are small amount of storage in CPU. The data stored in registers has fast access
compared to data stored in memory.

Storage class of a variable gives information about the location of the variable
in which it is stored, initial value of the variable, if storage class is not specified; scope of the
variable; life of the variable.



There are four storage classes in C programming.

1 : Automatic Storage class.

2 : Register Storage class.

3 : Static Storage class.

4 : External Storage class.

1: Automatic Storage class : To define a variable as automatic storage class, the keyword „auto‟
is used. By defining a variable as automatic storage class, it is stored in the memory. The default
value of the variable will be garbage value. Scope of the variable is within the block where it is
defined and the life of the variable is until the control remains within the block.

Syntax : auto data_type variable_name;

auto int a,b;

Example:

void main()

{

int detail;

or

auto int detail; //Both are same

}


C PROGRAMMING Page 159

, isalnum(c) Int Determine if argument is alphanumeric. Return nonzero value
if true, 0 otherwise.

isalpha(c) Int Determine if argument is alphabetic. Return nonzero value if
true, 0 otherwise.

isascii(c) Int Determine if argument is an ASCII character,. Return nonzero
value if true, 0 otherwise.

isdigit(c) Int Determine if argument is a decimal digit. Return nonzero
value if true, 0 otherwise.

isgraph(c) Int Determine if argument is a graphic printing ASCII Character.
Return nonzero value if true, 0 otherwise.

islower(c) Int Determine if argument is lowercase. Return nonzero value if
true, 0 otherwise.

isprint(c) Int Determine if argument is a printing ASCII character. Return
nonzero value if true, 0 otherwise.

isspace(c) Int Determine if argument is a whitespace character. Return
nonzero value if true, 0 otherwise.

isupper(c) Int Determine if argument is uppercase. Return nonzero value if
true, 0 otherwise.

toascii(c) Int Convert value of argument to ASCII

tolower(c) Int Convert letter to lowercase

toupper(c) Int Convert letter to uppercase.



6 : TIME LIBRARY FUNCTIONS <TIME.H>

Functions DataType Purpose

difftime(11,12) double Return the time difference 11-12, where 11 and 12
represent elapsed time beyond a designated base time.

time(p) long int Return the number of seconds elapsed beyond a designated
base time.




C PROGRAMMING Page 158
$15.63
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
akhilagouri

Get to know the seller

Seller avatar
akhilagouri A Level Notes
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
2 year
Number of followers
0
Documents
107
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions