Example
#include "header.h"
int main() {
greeter();
printf("PI: %.5f\n", PI);
printf("Golden Ratio: %.5f\n", GR);
struct Student s1 = {"Ada Lovelace", 42, 1.0f};
printf("Student: %s, ID: %d, Grade: %.1f\n",
s1.name, s1.studentId, s1.classification);
return 0;
}
Compile command for reference:
gcc main.c header.c -o main.exe
#ifndef HEADER_H
#define HEADER_H
#include <stdio.h>
void greeter();
#define PI 3.14159
#define GR ((double)1.61803)
struct Student {
char name[50];
int studentId;
float classification;
};
#endif
#include "header.h"
void greeter(){
printf("Hello World!")!
}