A variable is a name of the
memory location. It is used to store data. Its value can be changed, and it can
be reused many times.
It is a way to represent memory
location through symbol so that it can be easily identified.
Let's see the syntax to declare a
variable:
·
int a;
·
float b;
·
char c;
int a=10, b=20; //declaring 2
variable of integer type
float f=20.8;
char c='A';
Valid
variable names:
int a;
int _ab;
int a30;
Invalid
variable names:
int 2;
int a b;
int long;
Types
of Variables in C:
·
local variable
·
global variable
·
static variable
·
automatic variable
·
external variable
No comments:
Post a Comment