What does static mean in c?

Answer Posted / sasi

Whenever Static is used with a Variable declaration .. it defines that the last updated value of the Variable will not be deleted after the process of a program .
Eg : #include <stdio.h>
int main() {
func();
func();
func();
}
void func() {
static int i=2;
i=i+1;
printf("%d
",i);
return 0;
}
Output :
3
4
5

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

3102


Write a program to swap two numbers without using third variable?

917


How to Throw some light on the splay trees?

703


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

776


Why can’t constant values be used to define an array’s initial size?

960






printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

732


Why is structure padding done in c?

764


all c language question

1991


Sir i need notes for structure,functions,pointers in c language can you help me please

2032


What is the purpose of & in scanf?

701


Where are c variables stored in memory?

677


Why is event driven programming or procedural programming, better within specific scenario?

2043


Explain the difference between null pointer and void pointer.

760


What are the features of c languages?

721


How can I read data from data files with particular formats?

701