summaryrefslogtreecommitdiff
path: root/4p30.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-08-21 20:55:10 +0200
committerOskar <[email protected]>2024-08-21 20:55:10 +0200
commit4c8377e5711e2c864c8754d1d6373c09da2ce7e1 (patch)
treed3c8703a39cb8bd2f1a3b22c868141f8eba35e95 /4p30.cpp
parente747f69eb9b34f2c99472ca1cd17e049c1b74c9c (diff)
more exercises
Diffstat (limited to '4p30.cpp')
-rw-r--r--4p30.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/4p30.cpp b/4p30.cpp
new file mode 100644
index 0000000..8a93455
--- /dev/null
+++ b/4p30.cpp
@@ -0,0 +1,32 @@
+#include <iostream>
+
+/*
+ *
+ * 4.30
+ *
+ * Wow! This was a tricky question.
+ */
+
+int f() {
+ return 1;
+}
+
+struct ddd {
+ int mem[10];
+};
+
+int main () {
+
+ struct ddd ggg;
+ struct ddd *p = &ggg;
+ int i = 0;
+ int x = 0;
+ int y = 0;
+ unsigned int a = 0;
+ unsigned int b = 0;
+ std::cout << sizeof (x) + y << std::endl;
+ std::cout << sizeof (p->mem[i]) << std::endl;
+ std::cout << (sizeof (a) < b) << std::endl;
+ std::cout << sizeof (f()) << std::endl;
+ return 0;
+}