c - Is there a way to use const variables in the definitions of other constants? -


I would like to use some predefined constants in the definition of a new stability, but my compiler does not like it:

const int = 1; Const int b = 2; Const int c = a; // Error: The initial element is constant const int sum = (a + b); // Error: The initial element is not constant

Is there any way to define consistently using values ​​of other constants? If not, what is the reason for this behavior?

Convert wars can not be defined as expressions.

  #define A (1) #define B (2) #define C (A + B) const int = a; Const int b = B; Const int c = C;  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -