In C programming, variable declared within a function is different from a variable declared outside of a function. The variable can be declared in three places. These are:
Position | Type |
---|---|
Inside a function or a block. | local variables |
Out of all functions. | Global variables |
In the function parameters. | Formal parameters |
So, now let's have a look at each of them individually.