Printing a pointer with <iostream>

Viewed 6384

Why does

#include <iostream>
using namespace std;

int main() {
  cout << (char*)0x10 << endl; 
}

segfault, but

#include <iostream>
using namespace std;

int main() {
  cout << (void*)0x10 << endl; 
}

seems to work just fine?

3 Answers
Related