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.
. 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.
No comments:
Post a Comment