how is an extern variable different from a static variable
Answers
Answered by
1
1. static allows u to use the variable in one program but extern allows u to use a variable in multiple programs.
2. scope of a static variable is it can be accessible only to that particular function/block where it is defined. whereas, Extern can be accessible to all the functions/block of the program.
3. Static is declared inside a function/block. whereas, extern is declared outside all functions/block.
Hope this helps!
2. scope of a static variable is it can be accessible only to that particular function/block where it is defined. whereas, Extern can be accessible to all the functions/block of the program.
3. Static is declared inside a function/block. whereas, extern is declared outside all functions/block.
Hope this helps!
Similar questions