Back to course

C Interoperability

Full Course: Zig Programming From Zero to Hero

C Interoperability

Zig can directly import C header files and link against C libraries. This makes it an excellent choice for modernizing C projects.

zig const c = @cImport({ @cInclude("stdio.h"); });

pub fn main() void { _ = c.printf("Hello from C library!\n"); }

Zig also understands C types and call conventions natively.