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