What is the difference between#include< >and#include" "

Showing Answers 1 - 8 of 8 Answers

jaiganesh

  • Oct 21st, 2005
 

General Convention for this notation is:

# include < > ---> Specifically used for built in header files.

# include " " ----->Specifically used for used for user defined/created n header file

deepika raipuria

  • Oct 21st, 2005
 

the second one is syntactically not correct.

  Was this answer useful?  Yes

manish chawla

  • Oct 23rd, 2005
 

BOTH THE SYNTAX ARE LOGICALLY CORRECT BUT THE DIFFERENCE IS THAT IN FORMER CASE THE COMPILER WILL LOOK FOR THE HEADER FILES IN THE SPECIFIED DIRECTORY ONLY BUT IN LATER CASE SEARCH IS MORE EXPANDED AND IT WILL SEARCH IN THE OTHER DIRECTORIES AS WELL FOR THE HEADER FILES.

  Was this answer useful?  Yes

Rajeev Mathur

  • Apr 23rd, 2006
 

It's the nature of we indians that we speak irrespective of whether it makes sense or not. It's said that we should first think and then speak but it turns out to be exactly opposite in our case (It's a different story altogether that  some time we dont think even after speaking !!!!)

I request all the group members not to post any comments which we ourself are not sure of. Please do some googling or refer to some good books before you come up with your own C compiler !!!! 

  Was this answer useful?  Yes

ashutosh_dasgupta

  • Apr 29th, 2006
 

#include <filename>#include "filename"

both of which cause a new file to be read at the point where they occur. It's as if the single line containing the directive is replaced by the contents of the specified file.

The effect of using brackets <> or quotes " " around the filename is to change the places searched to find the specified file. The brackets cause a search of a number of implementation defined places, the quotes cause a search of somewhere associated with the original source file.If the form using quotes can't find the file, it tries again as if you had used brackets..

In general, brackets are used when you specify standard library header files, quotes are used for private header files?often specific to one program only.

Regards,
ASD.

  Was this answer useful?  Yes

kbjarnason

  • Jul 2nd, 2010
 

#include "file.h" tells the preprocessor to look in places other than the standard locations first; generally this means looking in the current directory.

#include <file.h> tells the preprocessor to look in the standard locations.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions