Practice
Learn
← Quit
0 / 0 correct
Rust
Hard
1 of 897
How do you pass a Rust string to a C function expecting `const char*`?
A
Pass a String by value
B
Create a CString (adds a NUL terminator, rejects interior NULs) and pass .as_ptr(), keeping the CString alive
C
Pass s.as_ptr() from a &str directly
D
Use format! with \0 and hope