How to call C functions from Rust FFI

Call C functions from Rust by declaring them with `extern "C"` and invoking them inside an `unsafe` block.

Use the extern keyword to declare the C function signature and unsafe to call it, ensuring the C library is linked.

extern "C" {
    fn printf(format: *const i8, ...);
}

fn main() {
    unsafe {
        let msg = b"Hello from Rust\0";
        printf(msg.as_ptr() as *const i8);
    }
}

Compile with rustc main.rs -o main and link the C library if needed (e.g., -lc for standard C functions).