Why we use # file in c & c++??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 13

Why we use # file in c & c++???

15th Apr 2019, 9:30 AM
Warwal
Warwal - avatar
8 Answers
+ 9
Thanks Friends for Tell about # file it is very important lesson for me.
18th Apr 2019, 4:25 AM
Warwal
Warwal - avatar
15th Apr 2019, 9:51 AM
Aleksander Szczepura
Aleksander Szczepura - avatar
+ 6
Andrei O so is the pre-processor part of the Compiler?
16th Apr 2019, 6:43 AM
Sonic
Sonic - avatar
+ 4
What begins with # is usually an instruction to the compiler, so those lines are evaluated before any compiling process starts.
15th Apr 2019, 2:58 PM
Andrei O
Andrei O - avatar
+ 4
Sonic theoretically is considered separated from the compiler, but the main idea is that the # directives must be in some way or form communicated to the compiler so the pre-processor has no good reason to exist without a compiler. In practice is just easier to encapsulate the knowledge that # directives are processed before compilation, there are standalone preprocessors, Boost wave or GPP but in general, you can't preprocess a source without compiling it.
16th Apr 2019, 10:01 AM
Andrei O
Andrei O - avatar
+ 4
~ swim ~ What I meant is that you usually don't preprocess files without having in mind to compile them that's why you must specify specific parameters to the compiler in order to get the preprocessed output. Also, you can have a simple source file without any dependencies that can be compiled without being preprocessed if you like going to the extreme case scenarios just for the purpose of invalidating the main idea.
16th Apr 2019, 2:24 PM
Andrei O
Andrei O - avatar
+ 3
# file are used to run our program with including the predefined methods and classes.. .. it provides the public access to ur programs for using the inbuilt functions and headers...
27th Apr 2019, 5:59 PM
Geetanjali Kore
Geetanjali Kore - avatar
0
hitesh
15th Apr 2019, 5:24 PM
hitesh