progs/C0.c
changeset 211 e6e160c7ea33
parent 202 6740798264c1
child 231 60e046ab6c94
equal deleted inserted replaced
210:e8445573c812 211:e6e160c7ea33
     1 #include <string.h>
     1 #include <string.h>
     2 #include <stdio.h>
     2 #include <stdio.h>
     3 #include <stdlib.h>
       
     4 
     3 
     5 void foo (char *bar)
     4 void foo (char *bar)
     6 {
     5 {
     7   float my_float = 10.5;    // in hex: \x41\x28\x00\x00
     6    long my_long = 101010101; // in hex: \xB5\x4A\x05\x06
     8   char  buffer[28];        
     7    char  buffer[28];        
     9 
     8 
    10   printf("my float value = %f\n", my_float);
     9    printf("my_long value = %lu\n", my_long);
    11 
    10    strcpy(buffer, bar);    
    12   strcpy(buffer, bar);  
    11    printf("my_long value = %lu\n", my_long);
    13  
       
    14   printf("my float value = %f\n", my_float);
       
    15 }
    12 }
    16  
    13  
    17 int main (int argc, char **argv)
    14 int main (int argc, char **argv)
    18 {
    15 {
    19   foo("my string is too long !!!!! ");                  // all is normal
    16   foo("my string is too long !!!!!"); 
    20   //foo("my string is too long !!!!! \x10\x10\xc0\x42");  // overwrites my_float
       
    21   return 0;
    17   return 0;
    22 }
    18 }
    23