Results 1 to 3 of 3
Hi,
I had a head file, looks like
#define MIN_NUM 10
#define MAX_NUM 10
is there any way to get "MAX_NUM" from 10?
thanks.
peter...
- 04-21-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 4
#define in c
Hi,
I had a head file, looks like
#define MIN_NUM 10
#define MAX_NUM 10
is there any way to get "MAX_NUM" from 10?
thanks.
peter
- 04-21-2011 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Simple answer? No. Why? Because many #defines may map the value 10 to some symbol. If you need to see what some #define symbol is equal to, then you can print it out, such as:
Code:printf("MIN_NUM == %d, MAX_NUM == %d\n", MIN_NUM, MAX_NUM);Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-24-2011 #3
Furthermore, #define is actually not part of C. Instead, it is part of the C preprocessor. By the time that your C compiler sees your source code, every instance of MAX_NUM has been replaced with 10.
You could probably write a program that would look at C source code and print out every #define to a certain value, but there is certainly nothing built into C or the preprocessor that does this.DISTRO=Arch
Registered Linux User #388732


Reply With Quote