Search code examples
cfunctioninclude

Can we use a header file without specifying its .h extension


For example ,we can use #include<stdio>instead of #include<stdio.h> in c , And can we used user defined function as a header file without specifying its extension,and add a file with .mp3 extension.


Solution

  • For example, [can we] use #include<stdio> instead of #include <stdio.h>

    In theory, yes, a compiler could provide that feature. In practice, no, I have never encountered a C compiler that let you do that.

    Why do you want to do that?

    can we used user defined function without specifying its extension

    I don't understand this question.

    and add a file with .mp3 extension

    Nothing stops you from saving your C programs into files with an .mp3 extension, instead of .c, and if you then run a C compiler on those files it'll probably compile them. But if you try to run a C compiler on a file that actually contains an audio recording in MP3 format, I don't see how that could possibly accomplish anything useful.