Login
Your Email
Pasword
Home
Write
Trending
History
Liked
Dashboard

Scope of variables in C language (module 9).

In this module we will discuss on the life time and scope of various variables in any C program.

Do you have similar website/ Product?
Show in this page just for only $2 (for a month)
Create an Ad
0/60
0/180
This is the 9th module on learning C with us. Earlier we discussed on the basic introduction and structure of C, preprocessor it's features, intermediate and executable codes. compilation and execution process of a C program. And keywords and identifiers, data types, variables and constants. 
In this section we will discuss on our next topic and most important concepts on the life time and scope of variables in program.
Scope of variables in C :-
All the variables that we intend to use in a program must have been declared with it's type specifier in an earlier point in the code.

#include
int var ;
char ch ;
int main()
{ unsigned int number ;
   float max ;
   ------------- ;
   ------------- ;
 }

A variable can be declared either of global or local scope. A global variable is a variable declared in the main body of the source code, outside all the functions while a local variable is one declared within the body of a function or a block.
Global variables can be referred from anywhere in the code, even inside functions, whenever it is after it's declaration.
The scope of local variables is limited to the block enclosed in braces {} where they are declared.
In next module we will discuss on the various operaters in any C language. For more information please be updated with us as we provide all the modules and cover all the topics regarding #C. Only on Www.newsandstory.com

CONTINUE READING
Scope
variables
program
#C
module(9)
Programming
coding
#c
Dalpat I
Content writer