top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Is it possible to write code using c without a header file?

+2 votes
513 views
Is it possible to write code using c without a header file?
posted Nov 18, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

It is depend on compiler. Some compilers are smart so that even you have not specified any header file and it will go to default path for header files and search for prototype.

I wrote a sample code and compiled:

int main()
{
   printf("Hello world\n");
   return 0;
}

warning: incompatible implicit declaration of built-in function âprintfâ

answer Nov 19, 2014 by Ganesh
0 votes

For GCC,,,

In headerfile you may have Declaration of functions, Defination(body) of functions, structures, and etc,
so its depend upon progamm , if declaration is not ther then copiler will show Warning but you can run your programm, but if you are using your headerfile for defination for function or structure then you wil get an error in LINKER stage.

I hope i have cleared your doubt.

answer Nov 28, 2014 by Chirag Gangdev
...