n********r 发帖数: 65 | 1 /*------------- code begin --------------- */
#include
const double theta = 0.5 * atan(2);
int main(void)
{
double a = 3.14159;
.....
.....
return 0;
}
/*------------- code end --------------- */
some books say the global variables are initilized
at the compile time. Is this true in the above case?
If in this case theta is initialized at the run time,
then when does the code " theta = code 0.5 * atan(2) " been executed?
before " double a = 3.14159 " or after that? |
k****f 发帖数: 3794 | 2 atan需要用到math lib,编译的时候还没有math lib
link的时候才能看的
【在 n********r 的大作中提到】 : /*------------- code begin --------------- */ : #include : const double theta = 0.5 * atan(2); : int main(void) : { : double a = 3.14159; : ..... : ..... : return 0; : }
|
N*********y 发帖数: 105 | 3 before main() actually executes.
【在 n********r 的大作中提到】 : /*------------- code begin --------------- */ : #include : const double theta = 0.5 * atan(2); : int main(void) : { : double a = 3.14159; : ..... : ..... : return 0; : }
|