ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

Answer1


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

Archive

WHAT'S YOUR ENGINEERING QUOTIENT?

Test Your EQ

Problem 1What is the difference between the declaration and the definition of a symbol?


Answer:

The declaration of a symbol tells the compiler what kind of symbol it is. This allows the compiler to generate code that correctly accesses the symbol.

The definition of a symbol actually allocates space for and defines the contents of the symbol.

The difference is important when you are building a project from separately-compiled modules that need to share data and subroutines. Each shared item should be declared wherever it is used, but defined only once.

For example, in C, you might put the declaration


extern int debug_flag;
in an include file used by all modules that need to access debug_flag. However, only one source file will contain the definition:

int debug_flag = 0;

Contributor: Naveen P N

 

8-01 — NEXT Q&A


For questions or comments about
Test Your EQ, e-mail eq@circuitcellar.com
.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ