C Programming - C Preprocessor - Discussion

Discussion Forum : C Preprocessor - Yes / No Questions (Q.No. 4)
4.
It is necessary that a header files should have a .h extension?
Yes
No
Answer: Option
Explanation:

No, the header files have any kind of extension.

Discussion:
16 comments Page 2 of 2.

Kapil said:   1 decade ago
No such header files exist without .h extension.

Sundar said:   1 decade ago
@ALL

Is is necessary that a header files should have ".h" ?

Answer is NO.

Because the header files can have any extension but it should be included with in C program with same extension.

Let me explain what I did to check this...

In Turbo C directory

C:\Turbo>copy stdio.h stdio.hdr
C:\Turbo>copy conio.h conio.exe

Then I used the line following line to include the header file.

#include<stdio.hdr>
#include<conio.exe>

void main()
{
printf("Welcome to IndiaBIX.com !");
getch();
}


The output : Welcome to IndiaBIX.com !

Mani kandan said:   1 decade ago
We can define fact.c, filename.c in header file.

So, if you mention filename.c, it will read the entire file.

Manishsoni said:   1 decade ago
How can this possible please anyone elaborate it ?

Atul said:   1 decade ago
Can you tell me what are all the other extensions other than .h ?

Avkash Agrawal said:   1 decade ago
We know that we use many headder file such as

stdio.h, dos.h, conio.h, stdlib.h, graphics.h, iostream.h etc.

So how can you say that there is no need of this extension ?


Post your comments here:

Your comments will be displayed after verification.