What does it mean to define a structure in a .h file in C?
please eleaborate: give examples of elements of the structure and of an actual definition vs decleration
Thanks a lot!
- Mark aka jack573Lv 710 years agoBest Answer
Here is a page that will help.
It has example files you can download.
This page gives an example also, but it is pretty long and could be confusing.
- L.S. HillLv 410 years ago
It means to declare all the elements of the structure in a .h file. The declaration is in the .h, and the actual definition goes into the .c file.
Don't "define" in a .h file. It's bad style.
- Anonymous10 years ago
An ".h" file is a C header file. It holds a variety of information about variables and constants needed to compile programs. When you create a struct in C, and you wish to reference it across all your source code, you place it in a header file, then include the header file in your program source.
This is pretty basic stuff.
- 10 years ago
.h means "Header"
when you compile de .c file, that will be the source code "visible" to other C programs that want to access that one.