#include <iostream>
using namespace std;
int main() {
int i {1};
int *pi = 0; // Probiert mal NULL und nullptr aus.
cout << " i = " << i << endl;
cout << " pi = " << showbase << hex << pi << endl;
// stuerzt ab, da pi nullptr:
// cout << "*pi = " << *pi << endl;
pi = &i;
if (pi == nullptr) {
cout << "pi ist nullptr" << endl;
} else {
cout << "pi ist kein nullptr" << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main() {
char const *cstring_a = "hallo";
char cstring_b[] = "welt";
char *cptr = (char*)cstring_a;
//cstring_a[0] = 'H';
cstring_b[0] = 'W';
//*cptr = 'H';
cout << cstring_a << endl;
cout << cstring_b << endl;
return 0;
}
int j = 42;
int *k = 0x4711;
k = k + 12;