Category: 02. Fortran

  • 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

    Fortran allows you to read data from, and write data into files. 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…

  • Basic Input Output

    We have so far seen that we can read data from keyboard using the read * statement, and display output to the screen using the print* statement, respectively. This form of input-output is free format I/O, and it is called list-directed input-output. The free format simple I/O has the form − However the formatted I/O gives you more flexibility over data transfer. Formatted…

  • 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…

  • Dynamic Arrays

    A dynamic array is an array, the size of which is not known at compile time, but will be known at execution time. Dynamic arrays are declared with the attribute allocatable. For example, The rank of the array, i.e., the dimensions has to be mentioned however, to allocate memory to such an array, you use the allocate function. After the…

  • Arrays

    Arrays can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. All arrays consist of contiguous memory locations. The lowest address corresponds to…

  • Strings

    The Fortran language can treat characters as single character or contiguous strings. A character string may be only one character in length, or it could even be of zero length. In Fortran, character constants are given between a pair of double or single quotes. The intrinsic data type character stores characters and strings. The length of the…