1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// just needed so you actually can compile this with gcc
typedef unsigned long uint64_t;

// for passing an argument and receiving a return value
uint64_t arg;

void
getui()
{
    // implementation of subprogram getui
    scanf("%lu", &arg);
}

void
puts()
{
    // implementation of subprogram puts
    printf("%s", arg);
}

void
putui()
{
    // implementation of subprogram putui
    printf("%lu", arg);
}
// some string literal
char msg[] = "You typed: ";

void
main()
{
    // local variable
    uint64_t    n;

    // call subprogram getui, copy return value to local variable
    getui();
    n = arg;

    // copy pointer to string literal to arg, call puts
    arg = msg;
    puts();

    // copy local variable to arg, call putui
    arg = n;
    putui();
}