Local Variable in C


Local variables are variables declared within a function or more specifically say within a block and local variable is only accessible within a specific part of a program. We also have to declare a local variable in c at the beginning of a given block. A user also has to initialize this local variable in a code before we use it in the program.

Source Code

//Local Variable
 
#include<stdio.h>
 
int add()
{
    int a,b;
}
 
int main()
{
    for(int i=0;i<5;i++)
    {
        printf("\n%d",i);
    }
     //printf("\n%d",i);
    return 0;
}
 
To download raw file Click Here

Output

0
1
2
3
4

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C