Skip to Main Content
Xpress Learning - Computer Fundamentals of Programming an IT by Pearson
book

Xpress Learning - Computer Fundamentals of Programming an IT by Pearson

by Ashok N. Kamthane, Rohit Khurana
May 2024
Beginner to intermediate content levelBeginner to intermediate
465 pages
16h 14m
English
Pearson India
Content preview from Xpress Learning - Computer Fundamentals of Programming an IT by Pearson
Storage Class II-241
void func(void);
static c=4;
void main()
{
clrscr();
while(c--)
{
fun();
}
}
OUTPUT:
i is 1 and count is 3
i is 2 and count is 2
i is 3 and count is 1
i is 4 and count is 0
b. Program with auto keyword
void func(void);
int c=4;
void main()
{
clrscr();
while(c--)
{
fun();
}
}
fun( void )
{
auto int i=0;
i++;
printf("i is %d and count is %d\n", i, c);
}
OUTPUT:
i is 1 and count is 3
i is 1 and count is 2
i is 1 and count is 1
i is 1 and count is 0
Explanation:  Due to auto class, the value of variable does not retain between calling function; hence,
the value of i remains 1 throughout the different calling functions.
M11_ITL-ESL4791_02_SE_C11.indd 241 12/22/2012 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Express Learning - Computer Fundamentals and Programming

Express Learning - Computer Fundamentals and Programming

Ashok Kamthane, ITL ESL
Windows® Internals, Sixth Edition, Part 2

Windows® Internals, Sixth Edition, Part 2

David A. Solomon Mark E. Russinovich and Alex Ionescu

Publisher Resources

ISBN: 9781299954878