Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate libc; // 0.2.42
- use std::mem;
- fn create_like_in_c_lol(n: usize) {
- unsafe {
- let p = libc::malloc(n * mem::size_of::<u32>()) as *mut u32;
- for i in 0..(n as u32) {
- *(p.offset(n as isize)) = i;
- println!("Value: {}", *(p.offset(n as isize)));
- }
- }
- }
- fn main() {}
Add Comment
Please, Sign In to add comment