Why are variables not initialized to zero in fortran 2003 compared to f90?
I have a variable in a function from a file. its initialized to 0. I want to use it in another function, then it shows the value of the garbage. even for global variables. Is there any parameter I need to set for fortran 2003 compiler?
You can try using -zero or / Qzero - this will initialize the local scalars to zero, but you really must explicitly specify the initial values. Depending on the compiler, to do this for you, you, as you know, are a good way to introduce errors. Note that option names may differ for different compilers. Those in question relate to Intel Visual Fortran .
Compaq Visual Fortran Intel Visual Fortran. , Fortran, , Workshop Alex, - . , . , .
Compaq Visual Fortran . . . .
Fortran, , . . , . , , , . , , , , 0. , , ..
Fortran 90 Fortran 2003 . Fortran 90 Fortran 2003 ( , , , , ).
, , , , , . , , , , .