I want to take a string input and display it in Fortran. I tried doing this
program name
implicit none
character(:), allocatable :: a
print *, "Enter a name: "
read(*,*) a
print *, "Hello, ", a, "!"
end program name
But I get an error
Enter a name:
Coder
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x657724a3
#1 0x656ff44d
#2 0x4010d0
How do i solve it? I just want to take someone's name and display it