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?

  1. double *a[n];
  2. double (*b)[n];
  3. double (*c[n])();
  4. 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

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -