Does Fortran have common blocks in common blocks? Like there are structs within structs. E.g.
integer int 1, int2
common/Common1/int1, int2
float f1, f2
common/Common2/f1, f2
save/Common2/, /Common1/
Does the above code mean that common2, in within common1?
No, the code you wrote is invalid. A common block is simply a named region of memory.
Fortran has "derived data types" that are very similar to C structs. A Fortran derived type declaration looks like this:
Now you can declare another derived type that contains a variable of this type:
Note that these are declarations of a type, not instantiations of a variable of that type. It is best to put the declarations in a module, allowing you to access them in a subroutine, function, or program. For example, suppose the declarations above are placed in a module named "my_structs_mod". Then you can use them like this:
Note that the percent sign (%) is similar to the dot (.) operator in C. It allows you to access the data contained in a derived type.