• Atom Feed

    Create Atom feed for your website in minutes
  • C Code Auto Indent

    Auto indent your entire C project with a simple shell command
  • C file ops

    Can you perform insert operation using C file operations? Check this C code and C file operations concepts
  • C posix signals

    Everything on Linux Signals and Signal handling, with sample code
  • Django MVC Framework

    Setting up Python Django website on Apache Shared web hosting server
  • FTP

    FTP Unix Command with examples
  • GlusterFS

    Concepts, Installation and Performance Benchmarking Reports
  • File Append in Java

    Program to perform File Append operation in Java
  • Essential Linux Commands

    Learn the basic essential linux commands in minutes
  • Loop Device in Linux

    Create loop device in Linux
  • PostgreSQL Database

    Installation and Startup Script
  • Pthreads - POSIX Multithreading

    APIs, Concepts and Sample Programs
  • Python Ctypes Module

    Intermixing C with Python and extending Python, with sample programs
  • Socket Programming

    Socket Programming in Linux explained, with TCP and UDP examples
  • String Functions in C

    Did you know string manipulation in C is so easy?
Home CPP Interview Questions

What is difference between the following syntax:
#include <filename.h>
#include "filename.h"
When to use each of the above?

How to include header files?

File inclusion can be done in the following 2 ways:

#include <filename.h>
#include "filename.h"

Each of the format specifies the path for the compiler to look for inclusion file filename.h

All standard header file like iostream, stdio.h are located in a standard path and they should be included as #include <filename.h>.

On Linux, gcc looks at:
libdir/../include/c++/version
/usr/local/include
libdir/gcc/target/version/include
/usr/target/include
/usr/include

All project specific user defined header files should be included in #include "filename.h" . Compiler now looks into same folder where the file being compiled is present, then at paths specified for compile option -iquote and then -I and then in above mentioned standard paths.