#include <iostream>
#include <cstring>
int main() {
char a[]="abc";
char b[]="def";
std::strcpy(b,a);
printf("%s\n", b);
std::cout << a << std::endl;
}
why std::
is optional when using printf, while std::
cannot be omitted with cout
and endl
?
In /usr/include/c++/cstdio
, printf
is in std namespace.
namespace std {
using ::printf;
}
But I do not understand the meaning of using ::printf
. I only know using namespace namespace_name
. What does ::
mean? And the using clause is in a namespace, how can it work?