Saturday, June 4, 2011

C Program without a Header File

It is possible to write a c program without using a header file .

For this we have to do the following :
We will first have to save the program with the extension .c  . eg: wht.c
After this execute the file. The compiler will itself include the header files.
This will work in the case of C++ also.

Example Problem:
void main()
{
int a,b,c;
printf("Enter the values of a and b ");
scanf("%d %d",&a,&b);
c= a+b;
c++
printf("The value is %d",c);
}

After writing the code , save with .c extension and then execute. 
Goodluck.....................................

2 comments:

  1. it does not work....compiler give some prototype error

    ReplyDelete
  2. its working in turbo c compiler good one but why is this happeneing

    ReplyDelete