Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Example of static variable in function

Posted By: Luigi Fischer     Category: C Programming     Views: 7367

Example of static variable in function.

Code for Example of static variable in function in C Programming

#include <stdio.h>
int g = 10;    \\ A
main()
{
int i =0;    \\ B
void f1();    \\ C
f1();        \\ D
printf(" after first call \n");
f1();        \\ E
printf("after second  call \n");
f1();        \\ F
printf("after third  call \n");

}
void f1()
{
staticint k=0;    \\ G
int j = 10;        \\ H
printf("value of k %d j %d",k,j);
k=k+10;
}
  
Share: 


Didn't find what you were looking for? Find more on Example of static variable in function Or get search suggestion and latest updates.

Luigi Fischer
Luigi Fischer author of Example of static variable in function is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!