#define identifier replacement question

Hi y'all,

This is my first post, so I wanted to say what's up to everyone! Secondly, if the following question has been answered on the forum, can you direct me to it. Thank you. Here it is...

I'm new to using preprocessor directives and have a question on using #define.
When defining an identifier, do you need a replacement?

Here is the code from my constants.h file I am writing from a book...


1. #ifndef _CONSTANTS_H
2. #define _CONSTANTS_H

4. //All my constants go here

6. #endif


See how there is no "replacement" in line two, only the identifier. How does this work?

Thank you.
You don't need a "replacement". When doing include guards you are only interested if the macro has been defined or not. What it has been defined as is not important because it is normally never used in such a way that it will be expanded.
I get it now. Thank you.
Topic archived. No new replies allowed.