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

What is a pointer on a pointer in c programming language?

621


What is the difference between exit() and _exit() function?

606


When we use void main and int main?

588


What are the 5 elements of structure?

568


What is a union?

611






PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1471


Can variables be declared anywhere in c?

624


Explain the use of #pragma exit?

699


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

585


Explain high-order bytes.

676


Who developed c language and when?

586


can any one tel me wt is the question pattern for NIC exam

1558


Are comments included during the compilation stage and placed in the EXE file as well?

672


what is the height of tree if leaf node is at level 3. please explain

1602


how to construct a simulator keeping the logical boolean gates in c

1730