Posts

Showing posts with the label Static

Storage Classes in C

Storage class determines the amount of memory allocated for the variable and how long the storage allocation continues to exist. It also determines the part of program over which that variable is visible. Four storage classes in C: 1. Auto 2. Register 3. External 4. Static Auto Storage Class: It is default storage class in C. These variables are declared inside the function in which they are to be used. They are created at the time of function call and destroyed automatically when we exit from the function. If automatic variables are not initialized, they will contain garbage value. Extern Storage Class:  These variables are declared outside the function. Generally, known as Global Variables and default value is zero. Extern declaration does not allocate storage space for variables. If any variable is declared as extern, then compiler checks for that variable initialization in the program. If that variable is not initialized, then compiler will show an error. Any ext...