In last post we learnt about how to declare the variable and when it declare, today we learnt about what are the scope and range of variable types so let's start :
Scope of variables
Scope of the variable means life of variable. The scope of variable is limited to the function where it declare. Let's take an example
#include <stdio.h>
void main()
{
int x;
x=5;
printf("\n Value of x is 5");
}
In above program the scope of the variable is inside the main function, if we want to access the variable outside the main function it is not accessible because it's scope is finished after "}" .
Range of the variable types or data types
following is the range of the various datatypes
Note : The size and ranges of int, short and long are compiler dependent. Size in this table are of 16 bit compiler.
No comments:
Post a Comment