How to make separate header file from code
Here is my example code :
Code:
#include <stdio.h>
void Func() {
static int x = 0;
x++;
printf("%d\n", x);
}
int main() {
Func(); // prints 1
Func(); // prints 2
Func(); // prints 3
Func(); // prints 4
Func(); // prints 5
return 0;
}
I need help to create header file from my code
Code:
#include <stdio.h>#include "test.h"
int main() {
Func(); // prints 1
Func(); // prints 2
Func(); // prints 3
Func(); // prints 4
Func(); // prints 5
return 0;
}
test.h
Code:
static int x ;
//code for header
I am bit confused I don't have any idea how to make header file test.h from the program