M
manish sahu
Is there any diff between Variable declaration and definition??
Whatever i understood is that
in case of auto,static and register storage class
variable declaration is its definition
(bcoz we are allocation memory while declaration( in register storage
cpu registers) for the variables
int main()
{
int i;
printf("%d",i);
}
but in case of external storage class variable declaration and
definition are different . In external storage class declaration
does'nt allocate memory space for variable it is done by variable
definition.
ex:
int main()
{
extern int a; //declaration
printf("%d",a);
return 0;
}
int a=10; // definition
Is it correct ?
PLz Reply
Thanks to all
Whatever i understood is that
in case of auto,static and register storage class
variable declaration is its definition
(bcoz we are allocation memory while declaration( in register storage
cpu registers) for the variables
int main()
{
int i;
printf("%d",i);
}
but in case of external storage class variable declaration and
definition are different . In external storage class declaration
does'nt allocate memory space for variable it is done by variable
definition.
ex:
int main()
{
extern int a; //declaration
printf("%d",a);
return 0;
}
int a=10; // definition
Is it correct ?
PLz Reply
Thanks to all