Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Memory for extern variable

Status
Not open for further replies.

M.RAMARAO

Newbie level 3
Joined
Nov 13, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
16
if we declare a variable as external(with "extern" keyword) where the memory will be allocated for this variable? or it will be allocated or not?
can anyone give me the clarification about this please..............
 

An external declaration is a reference to an otherwhere globally defined variable.

Without the definition, no storage is allocated and an "undefined object" error asserted.
 

All your program if it is a single file or spanned into multiple files gets compiled into one .hex file which is burned to the microcontroller. So, all your program will use the same ROM and RAM in the micro. Declaring a variable or function as extern is related only for the Compiler. If the Compiler encounters extern when Compiling then it know that the variable or function is in some other file. If the extern variable is a global variable then space will be allocated for it, if it is a non global variable then it gets created when the particular function is called.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top