pointers - Explaining C declarations in Rust -
i need rewrite these c declarations in go , rust set of practice problems working on. figured out go part, having trouble rust part. ideas or write these in rust?
- double *a[n];
- double (*b)[n];
- double (*c[n])();
- double (*d())[n];
assuming n
constant:
let a: [*mut f64, ..n]; // double *a[n]; let b: *mut [f64, ..n]; // double (*b)[n]; let c: [fn() -> f64, ..n]; // double (*c[n])(); fn d() -> *mut [f64, ..n]; // double (*d())[n];
these rather awkward , unusual types in language. rust's syntax, however, makes these declarations lot easier read c's syntax does.
note d
in c function declaration. in rust, external function declarations allowed in extern
blocks (see the ffi guide).
Comments
Post a Comment