Sunday, 8 December 2013

Run a 'C' program without using header file.

There is a question that can a 'C' program run without using any header file with no error?
The answer is yes. yes it is possible to run a 'C' program without use any header file in program .
lets take an example of a simple program.

void main()
{
        printf("hello world");
        getch();
}

Now save this program with .c extension for example "filename.c"
and run this program and output will be 
hello world.

But question is that how can it is possible ?
lets me explain, when we put the file extension .c then compiler behaves like as a c compiler and  c compiler contains all information's definition  about the header files. so compiler does not show any error except warnings.  
  

0 comments:

Post a Comment