In C programming, a local variable is a variable that is declared within a function or a block of code. Local variables are only accessible within the scope of the function or block in which they are declared, and they are not visible to other parts of the program. They are also known as automatic variables or stack variables.
The basic syntax for declaring a local variable in C is as follows:
data_type variable_name ;
Here, the data_type specifies the data type of the variable, and the variable_name is the name of the variable.
Here is an example of a local variable being used in a function:
//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
0 1 2 3 4
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions