In C is it recurrent to have .c
files including other internal .c
files with static variables / functions in a copy / paste manner? Like a .c
file composed of many .c
files where you want everything to be kept private and not declared in a header file.
Example:
a.c
static int a() {
return 3;
}
b.c
static int b() {
return 6;
}
c.h
int c();
c.c
#include "c.h"
#include "a.c"
#include "b.c"
int c() {
return a() + b();
}
main.c
#include <stdio.h>
#include "c.h"
int main() {
printf("%d\n", c())
}
To compile
clang -c c.c
clang -c main.c
clang c.o main.o -o test.exe