Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does the C language support upper case letters without giving or providing information about upper case in program

Tags:

c

#include<STDIO.H>  

It is in upper case but the program (compiles and) runs without any error in C language, but C is case sensitive — how this is possible?

#include<STDIO.H>
#include<CONIO.H>
main()
{
    printf("hello");
    getch();
}
like image 851
shoaib sabir Avatar asked Nov 24 '16 05:11

shoaib sabir


1 Answers

This works if you are using Windows or another operating system that ignores case on its file system. It doesn't work on Linux and other Unix flavours, because they do care about case (by default).

When you add an include statement like #include <any_file.h>, then the C-compiler will ask the operating system to open file any_file.h.

If your operating system doesn't care about case, then it will open any file that matches the pattern. If it, for instance, finds a file named aNy_fILe.H, it will open the file and present it to the C compiler.

The C-compiler will interpret the content of the file - this is the case-sensitive bit of the C language.

like image 165
NZD Avatar answered Oct 13 '22 01:10

NZD