progs/C1.c
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Tue, 07 Oct 2014 00:52:18 +0100
changeset 220 74772c30e0f4
parent 218 bc1f7c82e1a8
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
216
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
     1
#include <string.h>
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
     2
#include <stdio.h>
218
bc1f7c82e1a8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 217
diff changeset
     3
#include <stdlib.h>
216
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
     4
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
     5
void dead () {
217
8ddf4fe6bf31 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 216
diff changeset
     6
  printf("I will never be printed!\n");
8ddf4fe6bf31 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 216
diff changeset
     7
  exit(1);
216
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
     8
}
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
     9
218
bc1f7c82e1a8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 217
diff changeset
    10
void foo(char *bar) {
bc1f7c82e1a8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 217
diff changeset
    11
  char buffer[8];
bc1f7c82e1a8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 217
diff changeset
    12
  strcpy(buffer, bar);
bc1f7c82e1a8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 217
diff changeset
    13
}
105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
216
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
    15
int main(int argc, char **argv) {
218
bc1f7c82e1a8 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 217
diff changeset
    16
  foo(argv[1]);
216
38718062709a updated C2
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 112
diff changeset
    17
  return 1;
105
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
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22