"Slim Shady" is constant literal of type char[11]
which is convertible to const char*
. You can also use it for initialization of any char arrays bigger than 11. See:
char a[] = "Slim Shady";
char a[11] = "Slim Shady";
const char* a = "Slim Shady";
char a[12] = "Slim Shady";
See this little code:
#include <typeinfo>
#include <iostream>
template <class T>
void printTypeName(T t)
{
std::cout << typeid(T).name() << std::endl;
}
int main() {
printTypeName("Slim Shady");
printTypeName<decltype("Slim Shady")>("Slim Shady");
}
You get (on gcc) mangled names:
PKc
A11_c
From what I know - the first is const char*
the second is char[11]
. This is easy to explain since when passing array of anything to function - it is converted to const pointer.