#include

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vbwire
    New Member
    • Jan 2008
    • 19

    #include

    ok..maybe this is one of the most basic in c.. i've take c course in first year.. but i dont know what is the function of this.. #include..

    #include<stdio. h>
    #include<conio. h>
    #include<string .h>

    what is the different between these 3..
  • manjuks
    New Member
    • Dec 2007
    • 72

    #2
    Originally posted by vbwire
    ok..maybe this is one of the most basic in c.. i've take c course in first year.. but i dont know what is the function of this.. #include..

    #include<stdio. h>
    #include<conio. h>
    #include<string .h>

    what is the different between these 3..
    Hi,

    #include is used to include any files(header file, c files), For example printf and scanf are declared and defined in stdio.h If you want to use printf and scanf functions in your program you have to include stdio.h file. Like that string.h contains string handling functions. So you have to include which is necessary for your program.

    Thanks
    Manju

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      The key to your question is that #.

      When you compile your code, the code you have written (the implementation file) is read by a software application called the preprocessor. The preprocessor looks for things to do (called preprocessor directives) and these are all on lines that start with a #.

      Once a # line is found, your implementation file is altered (expanded) into a new file called a translation unit. It is this file that is actually compiled.

      So, the #include says to locate stdio.h and to paste a copy of it right where the #include is. You have a choice, you can locate stdio.h yourself and paste a copy of it in your program or you can let the preprocessor do it for you.

      Everyone use the #include.

      There are other preprocessor directives. They all start with a # and can be found in any C/C++ textbook. Or, perhaps, a Google.

      Comment

      Working...