void func(const char* str) { void *s = &str; std::cout << *(char**)s << std::endl; // it's correct std::cout << (char*)s << std::endl; // it's not correct }
int main() { char *str = "hello world"; func(str); return 0; }
Aucun commentaire:
Enregistrer un commentaire