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

  • Home
  • SEARCH
  • 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 1070163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:31:29+00:00 2026-05-16T20:31:29+00:00

I’m learning about dummy arguments and local variables in functions. One of the exercises

  • 0

I’m learning about dummy arguments and local variables in functions.

One of the exercises in the book I’m using is to write a program which asks the user for their first name and last name, then joins the names together and prints the full name. Here’s the code:

PROGRAM name_test
    IMPLICIT NONE

    ! Declare variables
    CHARACTER(LEN=12) :: first, last
    CHARACTER(LEN=30), EXTERNAL :: full_name

    ! 1. Ask for first name and family name, then read them
    PRINT *, "Please enter your first name"
    READ *, first
    PRINT *, "Please enter your family name"
    READ *, last

    ! 2. Join names together
    full_name(first, last)

    ! 3. Print welcome message
    PRINT *, "Welcome ", full_name(first, last)

END PROGRAM name_test

CHARACTER(LEN=*) FUNCTION full_name(first_name, last_name)
    IMPLICIT NONE

    ! Function which joins 2 names to form a full name

    ! Dummy argument declarations
    CHARACTER(LEN=*), INTENT(IN) :: first_name, last_name

    ! Local variables
    CHARACTER(LEN=LEN(first_name)) :: new_first_name
    CHARACTER(LEN=LEN(last_name)) :: new_last_name

    ! Use ADJUSTL to remove redundant leading blanks
    new_first_name = ADJUSTL(first_name)
    new_last_name = ADJUSTL(last_name)

    ! Join names
    full_name = TRIM(new_first_name)//" "//new_last_name

END FUNCTION full_name

When I try to compile, it comes up with an error referring to the function call at line 15:

full_name(first, last)

This is the compile error:

Error: Unclassifiable statement at (1)
  • 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-16T20:31:30+00:00Added an answer on May 16, 2026 at 8:31 pm

    You have an error on line full_name(first,last) – although it gives me syntax error, it may be just that the compilers are different.

    The function you’re using is returning a value, therefore you can use it directly in the print statement. There is no need for it to be used before that, and even if it was used before that, you would still need to assign its value (the one it returned) to something like

    string = full_name(first,last)

    Anyways, I shortened it up a little so here you go.

      program name_test
      implicit none
    
      character(len=12) :: first, last
      character(len=30), external :: full_name
    
      write(*,'("Please enter your first name : ",\)'); read(*,*)first
      write(*,'("Please enter your last name  : ",\)'); read(*,*)last
      write(*,'("Welcome ",A)')full_name(first,last)
    
      end program name_test
    
    
      function full_name(first,last)
      implicit none
    
      character(len=*) :: first, last
      character(len=30) :: full_name
    
      full_name = trim(adjustl(first))//" "//trim(adjustl(last))
      end function full_name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.