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:48





PDF Text (Beta):

defined. In simple terms, a static local variable is a local variable
that retains its value between function calls. For example, the
following program code defines Static variable 1 at two places
in two blocks inside function stati cDemo(). Function
staticDemo() is called twice within from main function.
During second call static variables retain their old values and they

are not initialized again in second call of staticDemo().
#include

٠ When static specifier is applied to a global variable or a
function then compiler makes that variable or function known only
to the file in which it is defined. A static global variable has internal
linkage that means even though the variable is global; routines in
other files have no knowledge of it and cannot access and alter its
contents directly. The following C program defines one static global
variable gInt and a static function stati 00௨௦ (9) for the
variable and function are defined static
they cannot be used outside the file (translation unit) staticdemo.c..

#include static
int gInt = 1; static void
staticDemo ()
{
Static in i;
printf("sd ", i);
i++; printf ("%d\n",
9101): gInt++;
}
int main() |
Static Demo();

Static Demo();

Static variables have default initial value zero and initialized only once in

their lifetime.

Similar Question Papers