Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
In computer programming, a static variable is a variable that has been allocated “statically”, meaning that its lifetime is the entire run of the program.
#include <stdio.h>
int main() {
auto int a = -18;
static int b = 8;
printf(“Auto variable : %d\n”, a);
printf(“Static variable b : %d\n”,b);
if(a!=0)
printf(“The sum of two variables : %d\n”,(b+a));
return 0;
}
OUTPUT:
Auto variable : -18
Static variable b : 8
The sum of two variable : -10