To clear illustrate the problem, here is a minimal code. Why there is no output for my line cout << z << endl;
? I am running it on Mac OS, compiler is Apple clang version 12.0.0 (clang-1200.0.32.29) Target: x86_64-apple-darwin20.3.0
#include <iostream>
using namespace std;
int main() {
int x = 15;
int *y = &x;
unsigned char *z = (unsigned char *)&x;
cout << y << endl; //this line works OK
cout << z << endl; //no output of this line
printf("%x", z); // this line works OK
return 0;
}
Aucun commentaire:
Enregistrer un commentaire