Skip to main content

C

C is a uniquely portable system programming language. Learn more at https://www.c-language.org/

Toolchains

Zig

Zig is a general-purpose programming language and compiler that also supports C. Learn more under Zig is also a C compiler, at https://ziglang.org/learn/overview/

Example

zig cc -target riscv64-linux guest.c -o guest.bin

Examples

Hello world

#include <stdio.h>

void say_hello(const char* message) {
printf("Hello %s!\n", message);
fflush(stdout);
}

int main(void) {
say_hello("world");
return 0;
}

Advanced API example

https://github.com/libriscv/libriscv/tree/master/examples/advanced