Category: 04. Fortran
-
Debugging Program
A debugger tool is used to search for errors in the programs. A debugger program steps through the code and allows you to examine the values in the variables and other data objects during execution of the program. It loads the source code and you are supposed to run the program within the debugger. Debuggers…
-
Programming Style
Programming style is all about following some rules while developing programs. These good practices impart values like readability, and unambiguity into your program. A good program should have the following characteristics − For example, if you make a comment like the following, it will not be of much help − However, if you are calculating…
-
Program Libraries
There are various Fortran tools and libraries. Some are free and some are paid services. Following are some free libraries − The following libraries are not free −
-
Numeric Precision
We have already discussed that, in older versions of Fortran, there were two real types: the default real type and double precision type. However, Fortran 90/95 provides more control over the precision of real and integer data types through the kind specifie. The Kind Attribute Different kind of numbers are stored differently inside the computer. The kind attribute allows you to specify how…
-
Intrinsic Functions
Intrinsic functions are some common and important functions that are provided as a part of the Fortran language. We have already discussed some of these functions in the Arrays, Characters and String chapters. Intrinsic functions can be categorised as − We have discussed the array functions in the Arrays chapter. In the following section we…
-
Modules
A module is like a package where you can keep your functions and subroutines, in case you are writing a very big program, or your functions or subroutines can be used in more than one program. Modules provide you a way of splitting your programs between multiple files. Modules are used for − Syntax of…
-
Procedures
A procedure is a group of statements that perform a well-defined task and can be invoked from your program. Information (or data) is passed to the calling program, to the procedure as arguments. There are two types of procedures − Function A function is a procedure that returns a single quantity. A function should not modify its…
-
File Input Output
In the last chapter, you have seen how to read data from, and write data to the terminal. In this chapter you will study file input and output functionalities provided by Fortran. You can read and write to one or more files. The OPEN, WRITE, READ and CLOSE statements allow you to achieve this. Opening…
-
Pointers
In most programming languages, a pointer variable stores the memory address of an object. However, in Fortran, a pointer is a data object that has more functionalities than just storing the memory address. It contains more information about a particular object, like type, rank, extents, and memory address. A pointer is associated with a target…
-
Derived Data Types
Fortran allows you to define derived data types. A derived data type is also called a structure, and it can consist of data objects of different types. Derived data types are used to represent a record. E.g. you want to keep track of your books in a library, you might want to track the following…