My God I even had a comp science teacher ask me this.Arrrg one will go mad.
It's simple.Cut a few funtions out of you code and paste them in a file with a .h extension and call #include "your_header_name.h" to include that.
Note: not < > but " " if it's in the current directory else you have to supply the full or relative path.
All the rules are same as normal C++ syntax.
That was very simple thing.Headers can be used for more things.They can just contain funtions declarations without definitions.In that case it will be used to link to a static library.
Eg.Make a header file with 2 funtion declarations like fun1(); fun2(); only
Include it with a cpp file and call the funtions and compile.
You will get no errors on compile but on linking you will see an error similar to the following:
undefined module fun1() refferenced from Module main.cpp
undefined module fun2() refferenced from Module main.cpp
I hope you understand a header in not really diffrent from a cpp file.Btw you can also include .cpp files.
write some functions||define some macros||define structures/classes etc...
DO NOT include a main() function
save it with the name you want
you use it through: #include "..."
if you have variables in your header, do not redeclare them in your programs or it will give you an error "Multiple declaration for variable..."
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...