Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int a = 2;
- int b = 3;
- int* c = &a;
- int d = 2;
- cout << " größe von int in byte: " << sizeof(int) << endl;
- cout << "größe von int* in byte: " << sizeof(int*) << endl;
- cout << "deklariert wurde nacheinander: int a, int b, int* c, int d\n\n" << endl;
- cout << " adresse von int a: " << uintptr_t(&a) << " (-" << sizeof(int) << ", korrekt)" << endl;
- cout << " adresse von int b: " << uintptr_t(&b) << " (-" << sizeof(int) << ", falsch?)" << endl;
- cout << " adresse von int* c: " << uintptr_t(&c) << " (-" << sizeof(int*) << ", falsch?)" << endl;
- cout << " adresse von int d: " << uintptr_t(&d) << endl;
- }
- #######################
- größe von int in byte: 4
- größe von int* in byte: 8
- deklariert wurde nacheinander: int a, int b, int* c, int d
- adresse von int a: 140736349410284 (-4, korrekt)
- adresse von int b: 140736349410280 (-4, falsch?)
- adresse von int* c: 140736349410272 (-8, falsch?)
- adresse von int d: 140736349410268
- Process returned 0 (0x0) execution time : 0.001 s
- Press ENTER to continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement