![]() | intro/var-const.c - De to matematiske konstanter pi og e, og forsøg på assignments til disse. | Lektion 2 - slide 10 : 24 Program 1 |
#define PI 3.14159 int main(void) { const double pi = 3.14159, e = 2.71828; pi = pi + 1; // compile time error: // assignment of read-only variable 'pi' e = e - 1; // compile time error: // assignment of read-only variable 'e' PI = 4.0; // compile time error: // lvalue required as left operand of assignment return 0; }