Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6924297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:38:44+00:00 2026-05-27T10:38:44+00:00

Allocatable arrays are possible in Fortran 90 and up. INTEGER, ALLOCATABLE, DIMENSION(:) :: test_int_array

  • 0

Allocatable arrays are possible in Fortran 90 and up.

INTEGER, ALLOCATABLE, DIMENSION(:) :: test_int_array

Allocatable scalars such as allocatable characters are possible in Fortran 2003.

CHARACTER(LEN=:), ALLOCATABLE :: test_str

I am wondering is it possible to declare an array, fixed or allocatable, of allocatable characters? (Possibly like something below, which does not compile unfortunately.)

CHARACTER(LEN=:), ALLOCATABLE, DIMENSION(4) :: test_str_array
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:38:45+00:00Added an answer on May 27, 2026 at 10:38 am
        program test_alloc
    
       character (len=:), allocatable :: string
    
       character(len=:), allocatable :: string_array(:)
    
       type my_type
          character (len=:), allocatable :: my_string
       end type my_type
       type (my_type), dimension (:), allocatable :: my_type_array
    
       string = "123"
       write (*, *) string, len (string)
       string = "abcd"
       write (*, *) string, len (string)
    
       allocate(character(5) :: string_array(2))
       string_array (1) = "1234"
       string_array (2) = "abcde"
       write (*, *) string_array (1), len (string_array (1))
       write (*, *) string_array (2), len (string_array (2))
    
       allocate (my_type_array (2))
       my_type_array (1) % my_string = "XYZ"
       my_type_array (2) % my_string = "QWER"
       write (*, *) my_type_array (1) % my_string, len (my_type_array (1) % my_string)
       write (*, *) my_type_array (2) % my_string, len (my_type_array (2) % my_string)
    
    end program test_alloc
    

    I found the syntax at http://software.intel.com/en-us/forums/showthread.php?t=77823. It works with ifort 12.1 but not with gfortran 4.6.1. Trying the work around of creating a user-defined type didn’t work either.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a new code in Fortran and hesitating between using allocatable arrays
Is there a way to create variable size arrays in Fortran on the stack
I have the following program module test contains subroutine foo() integer, allocatable :: a(:)
There are basically two ways to pass arrays to a subroutine in Fortran 90/95:
I'm really having trouble with Allocatable array. I have to copy all information from
I have a problem with passing of an array from Fortran to a c
In short, can I do something like this in fortran (any of the fortran
Two points -- first, the example is in Fortran, but I think it should
I am new to Fortran, and I would like to be able to write
I'm just trying to get a little familiar with Fortran (because I can) so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.