updated
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Mon, 06 Oct 2014 00:57:44 +0100
changeset 205 88416b7df38c
parent 204 8fe0dc898c73
child 206 0105257429f3
updated
progs/example1.c
progs/test.c
--- a/progs/example1.c	Sun Oct 05 18:20:31 2014 +0100
+++ b/progs/example1.c	Mon Oct 06 00:57:44 2014 +0100
@@ -1,8 +1,8 @@
-void function(int a, int b, int c) {
-   char buffer1[5];
-   char buffer2[10];
+void foo(int a, int b, int c) {
+   char buffer1[6] = "abcde";
+   char buffer2[10] = "123456789";
 }
 
 void main() {
-  function(1,2,3);
+  foo(1,2,3);
 }
--- a/progs/test.c	Sun Oct 05 18:20:31 2014 +0100
+++ b/progs/test.c	Mon Oct 06 00:57:44 2014 +0100
@@ -28,20 +28,20 @@
 
 void foo (char *bar)
 {
-  long my_long = 10;    // in hex: \xF2\x03\x00\x00
+  unsigned long long my_long = 101010101;    // in hex: \xB5\x4A\x05\x06
   char  buffer[28];        
 
-  printf("my_long value = %lu\n", my_long);
+  printf("my_long value = %llu\n", my_long);
 
   strcpy(buffer, bar);  
  
-  printf("my_long value = %lu\n", my_long);
+  printf("my_long value = %llu\n", my_long);
 }
  
 int main (int argc, char **argv)
 {
-  foo("my string is too long !!!!! ");                  // all is normal
-  foo("my string is too long !!!!! \x00\x00\x07\xE4");  // overwrites my_long
+  foo("my string is too long !!!!!");                  // all is normal
+  foo("my string is too long !!!!! \x15\xcd\x5b\x07"); // overwrites my_long
   return 0;
 }