2) Is there any special reason of- Why most C compilers include most of the header files implicitly, but in C++ we have to include them explicitly?
I don't think that is the case. You have to include header files in C also. Many (most) system headers include other headers.
3) Can a global variable in C be declared anywhere in the program(outside all functions)?
ex-
int i;
main()
{
/*body*/
}
int j;
test()
{
/*body*/
}
int k;
Is this code valid according to C standards?
yes, but remember that the variable has to have been declared before it can be used. That means function main() cannot use variable k.
4) Is the value of NULL=0 according to C/C++ standard?
c++ yes, C no. In C it can be (void *)0, and I've even seen several other variations on that depending on the compiler.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Offline 21,963 posts
since Aug 2005