| 1 |
fn print_int(value: i32) { |
| 2 |
let s = "%d\n\0"; |
| 3 |
let s_p = s as *const str; |
| 4 |
let c_p = s_p as *const i8; |
| 5 |
unsafe { |
| 6 |
printf(c_p, value as isize); |
| 7 |
} |
| 8 |
} |
| 9 |
|
| 10 |
fn main() { |
| 11 |
print_int(5); |
| 12 |
} |
| 13 |
|
| 14 |
extern "C" { |
| 15 |
fn printf(s: *const i8, ...); |
| 16 |
} |