Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extern

Status
Not open for further replies.

BaharPamuk

Programmer
Jan 30, 2006
16
TR
Hi all,

I want to reach a variable in another file without including the file. Does "extern" do this? Or are there any way of doing this?

I understand as "extern" does this in the tutorials, but when i try some basic examples, it didn't work.

Thanks.
 
If you have
int foo;
in one C file, then

extern int foo;
in another C file will allow you to access that variable.

Post what you tried, rather than just saying "it didn't work".


--
 
Have you by any chance defined it as extern in all the files?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top