progs/C1.c
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Mon, 06 Oct 2014 22:48:09 +0100
changeset 215 06cc38192865
parent 112 0711775cb6b0
child 216 38718062709a
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
void foo (char *bar)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
{
112
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 105
diff changeset
     3
  float my_float = 10.5;  // in hex: \x41\x28\x00\x00
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
  char  buffer[28];        
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
  printf("my float value = %f\n", my_float);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
  strcpy(buffer, bar);  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
  printf("my float value = %f\n", my_float);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
int main (int argc, char **argv)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
  foo("my string is too long !!!!! ");
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
  return 0;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19