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


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
What is the difference between #include <file> and #include ?file??
Category C Interview Questions
Rating (4.2) By 515 users
Added on 10/22/2004
Views 50552
Rate it!
Answers:

When writing your C program, you can include files in two ways. The first way is to surround the file you
want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable

INCLUDE=C:COMPILERINCLUDE;S:SOURCEHEADERS;

using the #include <file> version of file inclusion, the compiler first checks the C:COMPILERINCLUDE
directory for the specified file. If the file is not found there, the compiler then checks the
S:SOURCEHEADERS directory. If the file is still not found, the preprocessor checks the current directory.

The second way to include files is to surround the file you want to include with double quotation marks. This method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up. Using the #include ?file? version of file inclusion and applying it to the preceding example, the preprocessor first checks the current directory for the specified file. If the file is not found in the current directory, the C:COMPILERINCLUDE directory is searched. If the file is still not found, the preprocessor checks the S:SOURCEHEADERS directory.
The #include <file> method of file inclusion is often used to include standard headers such as stdio.h or
stdlib.h. This is because these headers are rarely (if ever) modified, and they should always be read from your compiler?s standard include file directory.

The #include ?file? method of file inclusion is often used to include nonstandard header files that you have created for use in your program. This is because these headers are often modified in the current directory, and you will want the preprocessor to use your newly modified version of the header rather than the older, unmodified version.



What is the difference between #include <file> and #include �file�?



 Posted by: merugu naresh babu    

Contact merugu naresh babu  Contact merugu naresh babu

When writing your C program, you can include files in two ways. The first way is to surround the file you want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location.
The second way to include files is to surround the file you want to include with double quotation marks. This method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up.



 Posted by: Prabhakar Anand    

Contact Prabhakar Anand  Contact Prabhakar Anand

plz send c questions with my mail id



 Posted by: prasanthi    

Contact prasanthi  Contact prasanthi

#include<file>
This will refer the given file in the standard input and output directory.
but
#include"file"
This will first refers the given file in the current directory if this not found it will refers in the standard input and output directory.



 Posted by: Hariprabha    

Contact Hariprabha  Contact Hariprabha

the answer is same that if
#include <stdio.h>
the preprocessorsearches the file in the current directoy (working directory) but "stdio.h" find in current directory first than the locations setted by the user



 Posted by: Ayush    

Contact Ayush  Contact Ayush

the hederfiles are in c basically two types.
1. #inclde<stdlib.h>
2. #include "file.h"
these two are to find exct location to acess the preprocessor to take the heaer file.



 Posted by: kasim    

Contact kasim  Contact kasim

What is the difference between #include <file> and #include ?file??
Answers:

When writing your C program, you can include files in two ways. The first way is to surround the file you
want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable

INCLUDE=C:COMPILERINCLUDE;S:SOURCEHEADERS;

using the #include <file> version of file inclusion, the compiler first checks the C:COMPILERINCLUDE
directory for the specified file. If the file is not found there, the compiler then checks the
S:SOURCEHEADERS directory. If the file is still not found, the preprocessor checks the current directory.

The second way to include files is to surround the file you want to include with double quotation marks. This method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up. Using the #include ?file? version of file inclusion and applying it to the preceding example, the preprocessor first checks the current directory for the specified file. If the file is not found in the current directory, the C:COMPILERINCLUDE directory is searched. If the file is still not found, the preprocessor checks the S:SOURCEHEADERS directory.
The #include <file> method of file inclusion is often used to include standard headers such as stdio.h or
stdlib.h. This is because these headers are rarely (if ever) modified, and they should always be read from your compiler?s standard include file directory.

The #include ?file? method of file inclusion is often used to include nonstandard header files that you have created for use in your program. This is because these headers are often modified in the current directory, and you will want the preprocessor to use your newly modified version of the header rather than the older, unmodified version.



--------------------------------------------------------------------------------

What is the difference between #include <file> and #include �file�?




When writing your C program, you can include files in two ways. The first way is to surround the file you want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location.
The second way to include files is to surround the file you want to include with double quotation marks. This method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up.




 Posted by: swathi    

Contact swathi  Contact swathi

When writing your C program, you can include files in two ways. The first way is to surround the file you
want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable

INCLUDE=C:COMPILERINCLUDE;S:SOURCEHEADERS;

using the #include <file> version of file inclusion, the compiler first checks the C:COMPILERINCLUDE
directory for the specified file. If the file is not found there, the compiler then checks the
S:SOURCEHEADERS directory. If the file is still not found, the preprocessor checks the current directory.

The second way to include files is to surround the file you want to include with double quotation marks. This method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up. Using the #include ?file? version of file inclusion and applying it to the preceding example, the preprocessor first checks the current directory for the specified file. If the file is not found in the current directory, the C:COMPILERINCLUDE directory is searched. If the file is still not found, the preprocessor checks the S:SOURCEHEADERS directory.
The #include <file> method of file inclusion is often used to include standard headers such as stdio.h or
stdlib.h. This is because these headers are rarely (if ever) modified, and they should always be read from your compiler?s standard include file directory.

The #include ?file? method of file inclusion is often used to include nonstandard header files that you have created for use in your program. This is because these headers are often modified in the current directory, and you will want the preprocessor to use your newly modified version of the header rather than the older, unmodified version.




 Posted by: sonika maheshwari    

Contact sonika maheshwari  Contact sonika maheshwari

Every system will have some standard paths configured. Such as /usr/lib, /usr/include etc in Linux. These are called system paths.

If a program is making use of standard headers provided by the framework, then those headers will be included in the program using #include <header> pre-processor directive. So that the header(s) will be searched in standard system directories first.

Where as if programmer wishes to include any header files other than standard ones, then they are normally included using #include " " directive.

However, the difference in above methods of header inclusion is only with the way headers are searched.



 Posted by: Ravi A Joshi    

Contact Ravi A Joshi  Contact Ravi A Joshi

when we are writing any c program we can include header files in two ways. First one is very familiar with all of us. that is #include<file name> and in some situations we need to use our own predefined functions in some other programs then we include that required file in the form of #include"file name".



 Posted by: mohan    

Contact mohan  Contact mohan

When writing your C program, you can include files in two ways. The first way is to surround the file you
want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable



 Posted by: santosh patil    

Contact santosh patil  Contact santosh patil

When writing your C program, you can include files in two ways. The first way is to surround the file you
want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable

INCLUDE=C:COMPILERINCLUDE;S:SOURCEHEADERS;

using the #include <file> version of file inclusion, the compiler first checks the C:COMPILERINCLUDE
directory for the specified file. If the file is not found there, the compiler then checks the
S:SOURCEHEADERS directory. If the file is still not found, the preprocessor checks the current directory.

The second way to include files is to surround the file you want to include with double quotation marks. This method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up. Using the #include ?file? version of file inclusion and applying it to the preceding example, the preprocessor first checks the current directory for the specified file. If the file is not found in the current directory, the C:COMPILERINCLUDE directory is searched. If the file is still not found, the preprocessor checks the S:SOURCEHEADERS directory.
The #include <file> method of file inclusion is often used to include standard headers such as stdio.h or
stdlib.h. This is because these headers are rarely (if ever) modified, and they should always be read from your compiler?s standard include file directory.

The #include ?file? method of file inclusion is often used to include nonstandard header files that you have created for use in your program. This is because these headers are often modified in the current directory, and you will want the preprocessor to use your newly modified version of the header rather than the older, unmodified version.


What is the difference between #include <file> and #include �file�?



 Posted by: manish    

Contact manish  Contact manish

When writing your C program, you can include files in two ways. The first way is to surround the file you want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location.
The second way to include files is to surround the file you want to include with double quotation marks. This method of inclusion tells the preprocessor to look for the file in the current directory first, then look for it in the predefined locations you have set up.




 Posted by: bidyut mahata    

Contact bidyut mahata  Contact bidyut mahata

#include<file>
means a standard directory such that input or output.
while
#include"file"
means a used current directory



 Posted by: abhishek shukla    

Contact abhishek shukla  Contact abhishek shukla

include<file>
This will refer the given file in the standard input and output directory.
but
#include"file"
This will first refers the given file in the current directory if this not found it will refers in the standard input and output directory.



 Posted by: raja    

Contact raja  Contact raja

there r basically 2 ways to iclude any header file...
the first one is to include using angle brackets..< n >...using angle bracket will tell the preprocessor to search in dfault drectory...if nt found dere...then searching will b done in current directory...
whereas...using " " will tell th preprocessor to search in current directory first...if nt found then searching will be done in default directory...



 Posted by: neha    

Contact neha  Contact neha

want to include with the angled brackets < and >. This method of inclusion tells the preprocessor to look for the file in the predefined default location. This predefined default location is often an INCLUDE environment variable that denotes the path to your include files. For instance, given the INCLUDE variable

The #include ?file? method of file inclusion is often used to include nonstandard header files that you have created for use in your program. This is because these headers are often modified in the current directory, and you will want the preprocessor to use your newly modified version of the header rather than the older, unmodified version.



 Posted by: anurudh kumar    

Contact anurudh kumar  Contact anurudh kumar

#include<file>
This will refer the given file in the standard input and output directory.
but
#include"file"
This will first refers the given file in the current directory if this not found it will refers in the standard input and output directory.



 Posted by: sachin khedkar    

Contact sachin khedkar  Contact sachin khedkar

#include"file":-It search the current path,command line path and than the standard path.Specially used for including project specific/user defined header file.
#include<file>:-It searches the command line paths and the standard path.Generally used for including predefined header file.



 Posted by: KSHITISH RANJAN ACHARYA    

Contact KSHITISH RANJAN ACHARYA  Contact KSHITISH RANJAN ACHARYA

The <header> tells the compiler to search out for the header file in its standard directory. Normally the default directories are placed under "inc" or "include" in the main directory where the program is installed.

On the other hand "header" tells the compiler to first find the header file in the current directory where the "project" is saved. It can be anywhere.

Advantage is having "header" is when you have costumized header which you want to move wherever you move your project.



 Posted by: Yogendra Namjoshi    

Contact Yogendra Namjoshi  Contact Yogendra Namjoshi

The hederfiles are in c basically two types.
1. #inclde<stdlib.h>
->IT IS A BUILT IN FILE BUT IT WAS MADE FOR COMPANY.
2. #include "file.h"
->IT HAD CREATED BY USER(OURSELF)



 Posted by: MACHCHAKUMAR    

Contact MACHCHAKUMAR  Contact MACHCHAKUMAR

#include <file> : this command would look for the file in the specified list of directories only.

#include "file" : this command would look for the file in the current directory as well as specified list of directories.



 Posted by: karthik    

Contact karthik  Contact karthik

#include"file.h" looks for current working directory as well as includeed path but #include<file.h>
looks for only the included path generally the first one is used for
developing large application where numbers of headers files needed to be included



 Posted by: RAJU SAHANI    

Contact RAJU SAHANI  Contact RAJU SAHANI


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
Can you define which header file to include at compile time?
View Answer
Can include files be nested?
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

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/1025/default.asp?cachecommand=bypass


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

1.08