This are some of my const agreements. It works.
#define Clock (32768*1275) const unsigned int Mem_size[8] = { 32, 320, 3200, 3200, 3200, 3200, 3200, 3200 }; // Delay-time * Clock * 1024 / 10 / Mem_size[0~7] const unsigned int Multiplicator[8] = { 0.0001 * Clock * 1024 / 10 / 32, 0.001 * Clock * 1024 / 10 / 320, 0.01 * Clock * 1024 / 10 / 3200, 0.1 * Clock * 1024 / 10 / 3200, 1.0 * Clock * 1024 / 10 / 3200, 10.0 * Clock * 1024 / 10 / 3200, 100.0 * Clock * 1024 / 10 / 3200, 1000.0 * Clock * 1024 / 10 / 3200 };
But one const can not refer to another const. For example i can not replace the number 3200 by Mem_size[2]. Why not? Is there a work around?
Sincerly yours
Triple, I was making a general statement - indeed, in this case it does not matter.
ANSI C89 (emphasis added). Note in particular that a declaration containing "const" is not the same thing as a "constant expression"
More latitude is permitted for constant expressions in initializers. Such a constant expression shall evaluate to one of the following: * an arithmetic constant expression, * an address constant, or * an address constant for an object type plus or minus an integral constant expression. An arithmetic constant expression shall have arithmetic type and shall only have operands that are integer constants, floating constants, enumeration constants, character constants, and sizeof expressions. Cast operators in an arithmetic constant expression shall only convert arithmetic types to arithmetic types, except as part of an operand to the sizeof operator. An address constant is a pointer to an lvalue designating an object of static storage duration, or to a function designator; it shall be created explicitly, using the unary & operator, or implicitly, by the use of an expression of array or function type. The array-subscript [] and member-access . and -> operators, the address & and indirection * unary operators, and pointer casts may be used in the creation of an address constant, but the value of an object shall not be accessed by use of these operators.
Compiler folding of expressions containing literals is a different question.