+ 4
It’s very simple. Just start by creating a header file (this new file should have the same name as the source code just add .h instead of .c) Now you’re going to cut and paste some things from your source file and paste them in your header file. Your header file needs to look like this #ifndef HEADER_FILE #define HEADER_FILE Here you should have the Structure declaration, all the important function declarations, macro definitions, and data type definitions. #endif Then you need to add #include <headefile.h> in your source code.
19th Feb 2022, 5:41 PM
A J
A J - avatar
+ 3
linked.h and linked.c need to have the same name and your header file needs to be this way #ifndef __LINKED_H__ #define __LINKED_H__ #endif
19th Feb 2022, 5:59 PM
A J
A J - avatar
0
A header file isnt necessary unless ur have several source files in ur project , but if you want to seperate them then you need to have a 4 files a header file (.h) a main (.c) , and your source code (.c) and a Makefile to compile everything
19th Feb 2022, 5:53 PM
A J
A J - avatar