G
Garma
How to implement encapsulation and scope like C++ in C?
What are differences between Declaration and Definition in C?
My understanding is:
/*this is declaration and definition*/
int a;
/*this is declaration*/
extern int a;/*this is declaration*/
/*this is declaration*/
int function(void);
/*this is definition*/
int function(void){
....
}
/*this is declaration*/
extern int function(void);
Definition IS a declaration.
Definition is having a storage.
Declaration just claims the existence of a variable or function.
Is there anything I am missing here?
Thanks for your comments!
What are differences between Declaration and Definition in C?
My understanding is:
/*this is declaration and definition*/
int a;
/*this is declaration*/
extern int a;/*this is declaration*/
/*this is declaration*/
int function(void);
/*this is definition*/
int function(void){
....
}
/*this is declaration*/
extern int function(void);
Definition IS a declaration.
Definition is having a storage.
Declaration just claims the existence of a variable or function.
Is there anything I am missing here?
Thanks for your comments!