Debian Codegraph @

gcc/testsuite/rust/compile/issue-1323-1.rs

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