interview questions and answers

Technical Interview Questions | C Interview Questions

Home interview questions Programming interview questions C 
Friday, 10 February 2012
Main Menu
Home
Online Test
Contest
Search
FAQs
Contact Us
Login
Most Popular Category
JAVA

Microsoft Technologies
ASP, C#, DotNet, ...

Programming
C++, PHP, VB, ...

SAP

Testing

Web Technologies

Polls
Does personal networking help in job search?
 
IT Placement Papers interview questions Programming interview questions C

This category contains C Interview Questions and Answers


What's the best way to declare and define global variables?

PDF Print E-mail


First, though there can be many "declarations" (and in many translation units) of a single "global" (strictly speaking, "external") variable or function, there must be exactly one "definition".
(The definition is the declaration that actually allocates space, and provides an initialization value, if any.)
The best arrangement is to place each definition in some relevant .c file, with an external declaration in a header (".h") file, which is #included wherever the declaration is needed.
The .c file containing the definition should also #include the same header file, so that the compiler can check that the definition matches the declarations.




Be first to comment this article

Only registered users can write comments.
Please login or register.

 
< Prev   Next >

Technical Interview Questions | C Interview Questions

Top!
Top!
Copyright © 2008 InterviewDuniya.com All Rights Reserved.
Partner Site: Maheshwari Matrimony