I am unable to understand the behavior of comments in C++. Why comment not executed by the compiler , what's the main reason, and in which header file the definition of comment can exit. Thanks
Comments (single line or multi lined) are not a part of the executable/ library. It is just in place, basically to document the code and make it easier to understand what's going on. Sometimes when the same source or header file is edited by multiple programmers, the other programmers might not know what a particular statement would do, how much it costs (performance and/ or memory), if it might throw an error and so on. The compiler basically ignores these statements as they are not needed to build the actual compiler output.
C++ has two main comment syntaxes,
//
: Single line comments./* */
: Multi line comments.