I have read a few ways to define a header file. What is the right way to do it?
This is from the C Programming Preprocessor tricks:
http://www.cprogramming.com/tutorial/cpreprocessor.html
And this is from wikipedia's page on #include guard.Code:#ifndef _FILE_NAME_H_ #define _FILE_NAME_H_ /* code */ #endif // #ifndef _FILE_NAME_H_
http://en.wikipedia.org/wiki/Include_guard
Are you supposed to put underscores at the start and end of the header name? Or are you supposed to just put them before the H?Code:#ifndef GRANDFATHER_H #define GRANDFATHER_H struct foo { int member; }; #endif