| 1. |
What Does "common/control/ A, B, C" Do To The Values Of A, B, C? |
|
Answer» It doesn't do anything to the values. It just establishes a place in memory for the values to be stored and retrieved. Every subroutine and function in your program that contains the line "COMMON/CONTROL/ A, B, C" will agree that operations using variables A, B, or C will get numbers from or put numbers in the same appropriate LOCATION in memory. That is, they agree that a reference to "A" means the same in all routines with common CONTROL, etc.. To give A, B, or C a value, you have two options. You can assign values at compilation TIME with a BLOCK DATA routine: BLOCK DATA ABCVAL COMMON/CONTROL/ A, B, C DATA A,B,C / 1.0, 2.0, 3.0/ ENDYou can also assign and use values with executable statements. Say subroutines SUB1 and SUB2 contain this common block. If SUB1 contains the LINES "A=1.0", and "B=2.0", and SUB2 has the line "C=A+B", then the value of C after this line in SUB2 is EXECUTED is 3.0. It doesn't do anything to the values. It just establishes a place in memory for the values to be stored and retrieved. Every subroutine and function in your program that contains the line "COMMON/CONTROL/ A, B, C" will agree that operations using variables A, B, or C will get numbers from or put numbers in the same appropriate location in memory. That is, they agree that a reference to "A" means the same in all routines with common CONTROL, etc.. To give A, B, or C a value, you have two options. You can assign values at compilation time with a BLOCK DATA routine: You can also assign and use values with executable statements. Say subroutines SUB1 and SUB2 contain this common block. If SUB1 contains the lines "A=1.0", and "B=2.0", and SUB2 has the line "C=A+B", then the value of C after this line in SUB2 is executed is 3.0. |
|