Accessing #define in .h files????
>In a number of .h files that are included in my code there are various
>#define MAX 80
>#define MIN 1
>#define LEN 20
> int bar;
> char bar2;
>in main or a function how do I access the defines in the .h files
> struct foo bar;
> int temp;
> bar.bar = 20; /* works fine*/
> temp = bar.MAX /* does not*/
>return 0; /* note no brackets if your one of those hot on
> /* that subject */
>How can I access the defines or cant I, or even worse, should defines
>like that not be used in .h files????
gotch..... it's true.... it should never work! :))
c.... 'bar.bar = 20' works fine, 'cause u r assigning the value 20 to
the field 'bar' of the structure 'bar'!! right??
now, when u do: 'temp = bar.MAX;' the compiler generates:
which have no meaning..... :?
so, WHY defines??? 'cause u may whish 2 do something like:
c? if u try to access a field of a struct, that field must exist!!! ;)
hope it helps