global extern vs and l extern variable

Thread Starter

Sleve Hope

Joined Apr 21, 2020
11
There are two types of variables local and global.
variables declared within a block/function is local. It is 'auto' storage class by default
and discarded on exit from block. Their scope is within the block.

variables with 'static' storage class retain their values across exit.
it can be local , or external to all blocks.Their scope is everywhere.


They can be made global by using 'extern' keyword storage class.

A variable is called global if it is declared outside of all blocks/functions.
 
Top