A
ashish
Hello,
Supposing I have a #def like so ..
#define A 10
Now A has been used everywhere in the code.
In loops ... for (i=0; i < A; i++)
And defines ...
int charArray[A];
And in structures
struct a {
int intarray[a];
};
Now, I want to define a variable B such that ..
#define B ( (my_mode) ? 20 : A)
Basically, B will be A (10 if my_mode is 0 (old) or 20 if my_mode is 1
(new).
Obviously this creates a problem with the integer array and the
structure definitions - I think I can do this only if it is a function
or in the for loop as above.
Is there any way I can achieve this or will I have to hardcode
#define B 20 and live with
int charArray [20]; etc. in all modes .
TIA
Supposing I have a #def like so ..
#define A 10
Now A has been used everywhere in the code.
In loops ... for (i=0; i < A; i++)
And defines ...
int charArray[A];
And in structures
struct a {
int intarray[a];
};
Now, I want to define a variable B such that ..
#define B ( (my_mode) ? 20 : A)
Basically, B will be A (10 if my_mode is 0 (old) or 20 if my_mode is 1
(new).
Obviously this creates a problem with the integer array and the
structure definitions - I think I can do this only if it is a function
or in the for loop as above.
Is there any way I can achieve this or will I have to hardcode
#define B 20 and live with
int charArray [20]; etc. in all modes .
TIA