0
Difference between#include<stdio.h> and namespace std;
Why is it so that in some books there is using namespace std; is used where as in some #include<stdio.h> is used what's the difference between them
1 Odpowiedź
+ 2
'include' basically does a copy-paste the value of a file to the location of the "include" line. This is used to make your source code (usually .c file) aware of a declaration of other source code (usually sits in .h file).
'using' basically tells the compiler that in the next code you are using something (usually a namespace) so you won't have to do it explicitly each time:
Instead of:
std::string a;
std::string b;
std::string c;
You could write:
using namespace std;
string a;
string b;
string c;