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