Fortran int to string

In this article let’s discuss about Fortran int to string. Let’s go through the following methods without any delay 🙂

The main idea behind converting a variable of any type to a string in Fortran 77 is to use the Write function to write that variable into a Character array variable of some length. In this scenario, we’ll be inserting an Integer into a Character array.

Method 1:

        integer(kind=4) :: aNumber
        character(len=64) :: aString

        write(aString,*) aNumber 

In the place of ‘*’ we can provide the label, kind of line number, which specifies the format to be converted.

Hope the above methods works for you. Happy Learning and get back to us Anytime.

Realted Posts : Hello world in fortran