APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY Previous Years Question Paper & Answer

Course : B.Tech

Semester : S1 and S2

Year : 2017

Term : DECEMBER

Branch : BIOTECHNOLOGY

Scheme : 2015 Full Time

Course Code : CS 100

Page:46





PDF Text (Beta):

3. Variables and functions declared outside a function are taken to be Static, with
external linkage.

Variables and functions having external linkage are available to all files
that constitute a program. File scope variables and functions declared as
static (described shortly) have internal linkage. These are known only
within the file in which they are declared. Local variables have no linkage
and are therefore known only within their own block.

Types of Storage Classes
There are four storage classes in C they are as follows:

1. Automatic Storage Class
2. Register Storage Class
3. Static Storage Class

4. External Storage Class

Now, let us discuss these storage classes one by one.

1. Automatic Storage Class

A
variable defined within a function or block with auto specifier belongs to
automatic storage class. All variables defined within a function or block by
default belong to automatic storage class if no storage class is mentioned.
Variables having automatic storage class are local to the block which they are
defined in, and get destroyed on exit from the block.

The following C program demonstrates the visibility level of auto
variables.
#include
Main ()
{ auto int i =
1;
{ auto int i =
2;
{ Auto
int
i=3;
printf ( ‏صا"‎ %d
+ 7 1) 7
}
printf ( "Sd", i);
) printf( "Sd\n ",
i);

}

OUTPUT
3

In above example program you see three definitions for variable 1. Here, you
may be thinking if there could be more than one variable with the same name.

Similar Question Papers