file-handling · intermediate · ~15 min
fwrite a single fixed-size value.
Implement int write_int_binary(const char *path, int v) writing the int v (native layout) to path. Return 0 on success, -1 on failure.
#include <stdio.h>
int write_int_binary(const char *path, int v) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.