Fortran Fortran 90 creating an array of unknown size

  • Thread starter Thread starter max2112
  • Start date Start date
  • Tags Tags
    Array Fortran
Click For Summary
The discussion revolves around creating a Fortran program to solve the Josephus Problem, focusing on a subroutine that initializes an array based on user input for the size. The user has implemented a subroutine to create an array of size n, but encounters issues with the program not functioning as expected. Key points include the need for dynamic array allocation in Fortran, as the current implementation uses fixed-size arrays which may lead to problems. Suggestions include using allocatable arrays to handle dynamic sizes and ensuring that the program outputs values after reading the size to verify functionality. The conversation emphasizes the importance of proper array management and output in Fortran programming.
Technology news on Phys.org
Summit like this:

Code:
subroutine(/arguments/)

real,allocatable :: array(:)

/code/

allocate ( array(x) )

/code/

deallocate ( array )

return
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 5 ·
Replies
5
Views
8K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 25 ·
Replies
25
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K