diff options
author | Oskar <[email protected]> | 2024-08-21 20:55:10 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-08-21 20:55:10 +0200 |
commit | 4c8377e5711e2c864c8754d1d6373c09da2ce7e1 (patch) | |
tree | d3c8703a39cb8bd2f1a3b22c868141f8eba35e95 /4p29.cpp | |
parent | e747f69eb9b34f2c99472ca1cd17e049c1b74c9c (diff) |
more exercises
Diffstat (limited to '4p29.cpp')
-rw-r--r-- | 4p29.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/4p29.cpp b/4p29.cpp new file mode 100644 index 0000000..44a0245 --- /dev/null +++ b/4p29.cpp @@ -0,0 +1,20 @@ +#include <iostream> + +/* + * + * 4.29 + * + * + */ + +int main () { + + int x[10]; + int *p = x; + auto xx = sizeof(x) / sizeof(*x); + auto pp1 = sizeof(p); + auto pp2 = sizeof(*p); + std::cout << xx << std::endl; // int is 32bit on my machine therefore 40 / 4 = 10 + std::cout << pp1 / pp2 << std::endl; // we get the size of a pointer(8) then the size of an int(4) = 2 + return 0; +} |