My instructor said to me that the correct way of using a struct always should be done in a .c file instead in a header file. BUT he couldn't explain why a struct should be in a .c file.
Can anyone tell me more about this?
My instructor said to me that the correct way of using a struct always should be done in a .c file instead in a header file. BUT he couldn't explain why a struct should be in a .c file.
Can anyone tell me more about this?
> Can anyone tell me more about this?
Perhaps your instructor is clueless - it seems to me that he is
Have a look in say time.h, that contains 'struct tm'
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I have now talked to another intructor and he said that placing struct in .h or a .c file makes no difference.
There is a difference, especially if you ever plan on having your projects take up more than one file. Fire your instructors.
Quzah.
Hope is the first step on the road to disappointment.
Was this really not about structs per se, but about declaration and definition?Originally Posted by Mikro
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*