File Inclusion in C

By: Jagan Emailed: 1729 times Printed: 2331 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

File inclusion makes it easy to handle collections of #defines and declarations (among other things). Any source line of the form
   #include "filename"
or
   #include <filename>
is replaced by the contents of the file filename. If the filename is quoted, searching for the file typically begins where the source program was found; if it is not found there, or if the name is enclosed in < and >, searching follows an implementation-defined rule to find the file. An included file may itself contain #include lines.

There are often several #include lines at the beginning of a source file, to include common #define statements and extern declarations, or to access the function prototype declarations for library functions from headers like <stdio.h>. (Strictly speaking, these need not be files; the details of how headers are accessed are implementation-dependent.)

#include is the preferred way to tie the declarations together for a large program. It guarantees that all the source files will be supplied with the same definitions and variable declarations, and thus eliminates a particularly nasty kind of bug. Naturally, when an included file is changed, all files that depend on it must be recompiled.


C Home | All C Tutorials | Latest C Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(1)


1. View Comment

my code is unable to open included files
how can it be solved


View Tutorial          By: MANAS at 2013-09-08 05:44:46

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Jagan
Importing a Certificate for the CA example using keytool in Java
The if-then-else Statement in Java
WHERE Clauses in SQL
The TryCatchFinally Interface in JSP
assert() Function Example program in C
Guidelines for Struts Application Development
Using printf function in C
File Inclusion in C
Using Multiple Message Resource Bundles in Struts
While and For Loops in C
Arrays sample program in C
Controlling Page Navigation in JSF - Static and Dynamic Navigation
Using cout.fill() in C++
Types of Profiles in J2ME
DateField sample program in J2ME

More Tutorials in C
Sum of the elements of an array in C
Printing a simple histogram in C
Sorting an integer array in C
Find square and square root for a given number in C
Simple arithmetic calculations in C
Command-line arguments in C
Calculator in C
Passing double value to a function in C
Passing pointer to a function in C
Infix to Prefix And Postfix in C
while, do while and for loops in C
Unicode and UTF-8 in C
Formatting with printf in C
if, if...else and switch statements in C with samples
Statements in C

More Latest News
Most Viewed Articles (in C )
Using memset(), memcpy(), and memmove() in C
Find square and square root for a given number in C
Error Handling - Stderr and Exit - sample program in C
UNIX read and write system calls sample program in C
Arrays of Structures example program in C
Using free() Function in C
Formatting with printf in C
Getting Started with C
Symbolic Constants using #define in C
Character Arrays in C
Precedence and Order of Evaluation in C
Variable Scope and functions in C
register Variables in C
Initialization of Variables in C
Structures and Functions in C
Most Emailed Articles (in C)
Listing Files and Directories sample program in C
Character Arrays in C
Arithmetic Operators in C
Relational and Logical Operators in C
Type Conversions in C (String to Integer, isdigit() etc)
Increment and Decrement Operators in C
getch and ungetch in C
Variable Scope and functions in C
Static Variables in C
register Variables in C
File Inclusion in C
Pointers and Function Arguments in C
Pointers and Arrays in C
Character Pointers and Functions in C
Pointer Arrays and Pointers to Pointers in C