write a program to explain static storage class

Static Variables in C

Programe in static variable using 

#include <stdio.h>

int main() {
   auto int a = -52;
   static int b = 12;

   printf("The value of auto variable : %d\n", a);
   printf("The value of static variable b :%d\n",b);

   if(a!=0)
   printf("The sum of static variable and auto variable : %d\n",(a+b));
   return 0;
}
Output:
Here is the output

The value of auto variable : -52
The value of static variable b : 12

Post a Comment

0 Comments