Thursday, July 9, 2009

What is the difference between '#include <SOME> ' and '#include "SOME" ' in C++ ?"

Using '#include %26lt;SOME%26gt;' will search for the file-specified (SOME) in the path you specified as the default path in your project setting. This is basically used for the standard headers files.





Using '#include "SOME" ' will first search the file (SOME)in the current directory and if not-found then it will search for the specified file in the default path. This option is used mostly for the user written header file(s).

What is the difference between '#include %26lt;SOME%26gt; ' and '#include "SOME" ' in C++ ?"
The file name is typically enclosed with %26lt; and %26gt; if the file is a system provided file, or in quotes if the file is user provided.





Examples:





#include %26lt;iostream%26gt;





#include %26lt;stdio.h%26gt;





#include "classified.h";
Reply:#include %26lt;stdio.h%26gt;


includes the header file immediately but





#include "stdio.h"


confirms that this header file exists and then includes it





Senthil


No comments:

Post a Comment