Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 43 lines (23 sloc) 0.406 kb
8baaf32 @dharmatech add print-literal-int. Update build-md.sh.
authored
1
2 # Print a literal integer
3
4 # C
5
6 ```c
cd1972f @dharmatech rebuild md
authored
7
8 #include <stdio.h>
9
10 int main ()
11 {
12 printf ( "%i\n" , 123 ) ;
13
14 return 0 ;
15 }
8baaf32 @dharmatech add print-literal-int. Update build-md.sh.
authored
16 ```
17
18 # Assembly
19
20 ```s
cd1972f @dharmatech rebuild md
authored
21
22 .include "utils.s"
23
24 global_text main
25
26 prepare_stack
27
28 mov $123 , %rax
29
30 print_int %rax
31
32 print_nl
33
34 return_integer $0
8baaf32 @dharmatech add print-literal-int. Update build-md.sh.
authored
35 ```
36
6c95218 @dharmatech more md
authored
37 # Assemble and run
38
39 $ gcc print-literal-int.s -lm && ./a.out
40 123
41
8baaf32 @dharmatech add print-literal-int. Update build-md.sh.
authored
42
Something went wrong with that request. Please try again.