Monday, May 24, 2010

What is the C/C++ equivalent to a fortran common block?

I have to convert some old Fortran code to C/C++ but there is a variable that is part of a common statement. What is the C/C++ equivalent of that?

What is the C/C++ equivalent to a fortran common block?
If I understand this correctly, common variables are variables that are global in scope in FORTRAN. In that case, there's two different types of "globality" in C++





You can declare the variable outside of any function in C++ which will make it global in scope. If you add the keyword "static" in front of it, then its scope will be limited to that particular module, but viewable by all functions in the module.


No comments:

Post a Comment