CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
Can include files be nested?
Category C Interview Questions
Rating (4.2) By 18 users
Added on 10/22/2004
Views 7913
Rate it!
Answers:

Yes. Include files can be nested any number of times. As long as you use precautionary measures , you can avoid including the same file twice. In the past, nesting header files was seen as bad programming practice, because it complicates the dependency tracking function of the MAKE program and thus slows down compilation. Many of today?s popular compilers make up for this difficulty by implementing a concept called precompiled headers, in which all headers and associated dependencies are stored in
a precompiled state.

Many programmers like to create a custom header file that has #include statements for every header needed for each module. This is perfectly acceptable and can help avoid potential problems relating to #include files, such as accidentally omitting an #include file in a module.



Yes, header files can be nested to any level. As long few good programming practices are followed:

1. Always use header file guarding to avoid multiple inclusions. This will cause issues during compilation. The compiler is going to complain about redeclaration/redeffinition of variables

2. Avoid circular inclusions. This is one of bigger blunders a naive programmer would do. This becomes impossible to resolve unless proper care is taken to design the header file structure in large projects



 Posted by: Ravi A Joshi    

Contact Ravi A Joshi  Contact Ravi A Joshi

Nesting cannot be done only in one case:-
f()
{
/*statements of function f*/
g()
}
i.e we cannot nest one a function into another function.



 Posted by: vedant swami    

Contact vedant swami  Contact vedant swami

yes.Included file can be nested any no.of time using below preprocessor
#ifndef my_file.h
#define my_file.h



 Posted by: Rohini choudhary    

Contact Rohini choudhary  Contact Rohini choudhary


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
How many levels deep can include files be nested?
View Answer
How can type-insensitive macros be created?
View Answer
What are the standard predefined macros?
View Answer
What is a pragma?
View Answer
What is #line used for?
View Answer
How do you override a defined macro?
View Answer
How can you check to see whether a symbol is defined?
View Answer
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
View Answer
How can I convert a number to a string?
View Answer
How can I convert a string to a number?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/1023/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.62