int a; is Definition and Declaration both ? or declaration only ?
sourabhtripathi
-10
Newbie Poster
Recommended Answers
Jump to Post
int a;
is a declaration as well as definition. This c statement not only says the type of the variable but also allocates the memory required for this variable.
Jump to Posthow shd i do only declaration then !!
extern int a; ???
is this right !!Yes.
extern
keyword tells to compiler that variable 'a' is defined somewhere else, i.e. with 'extern' we only do declaration of variables. AndDefinition = Declaration + Memory allocation + Initialization (sometimes)
,- such …
All 7 Replies
super-sonic
1
Newbie Poster
sourabhtripathi
-10
Newbie Poster
0x69
41
Junior Poster
sourabhtripathi
-10
Newbie Poster
0x69
41
Junior Poster
mvmalderen
2,072
Postaholic
0x69
41
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.