Push maar. Focking nice.
authorChris <mail@chriskamphuis.com>
Tue, 10 Feb 2015 15:03:28 +0000 (16:03 +0100)
committerChris <mail@chriskamphuis.com>
Tue, 10 Feb 2015 15:03:28 +0000 (16:03 +0100)
ass2/chris/sws1-s4109503-s4202015/exercise2.c [new file with mode: 0644]

diff --git a/ass2/chris/sws1-s4109503-s4202015/exercise2.c b/ass2/chris/sws1-s4109503-s4202015/exercise2.c
new file mode 100644 (file)
index 0000000..8df8beb
--- /dev/null
@@ -0,0 +1,21 @@
+#include<stdio.h>
+
+void show(unsigned char *p, size_t size){
+       for(unsigned char *i = p; i<p+size; i++)
+               printf("%p\t0x%02X\t\t%3i\n", i, *i, *i);
+}
+
+int main(void){
+       short i = 0x1234;
+       char x = -127;
+       long sn1 = 4109503;
+       long sn2 = 4202015;
+       int y[] = {0x11223344, 0x44332211};
+       printf("address\t\tcontent (hex)\tcontent (dec)\n");
+       printf("---------------------------------------------\n");
+       show((unsigned char *)&i, sizeof(i));
+       show((unsigned char *)&x, sizeof(x));
+       show((unsigned char *)&sn1, sizeof(sn1));
+       show((unsigned char *)&sn2, sizeof(sn2));
+       show((unsigned char *)&y, sizeof(y));   
+}