FAQ: Code Challenge: C++ Functions - Introduction

This community-built FAQ covers the “Introduction” exercise from the lesson “Code Challenge: C++ Functions”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn C++

FAQs on the exercise Introduction

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Can someone explain what is mean by a function having “no return value” please. The code below is returning something, given the parameters of “Beyonce”, “Knowles” is it not? so wouldn’t that be a value?


// Define introduction() here:
void introduction(std::string first_name, std::string last_name) {
std::cout << last_name << ", " << first_name << " " << last_name << “\n”;

int main() {

introduction(“Beyonce”, “Knowles”);


I did something unnecessarily longer, but it still works.

void introduction(std::string first_name, std::string last_name)
  std::string f_name = first_name;
  std::string l_name = last_name;
  std::cout << l_name << ", " << f_name << " " << l_name << std::endl;

Check this link out. See if it helps C++ Void Function

// version with user prompt

// Created by funkyvilla on 3/26/20.
// Copyright © 2020 funkyvilla. All rights reserved.


// function prototypes: getname, introduction (required if defining functions below main() )
void getname(std::string &first_name, std::string &last_name); // passing first name and last name by reference/memory
void introduction(std::string first_name, std::string last_name);

void getname(std::string &first_name, std::string &last_name) // prompts user for input
std::cout << "Enter first name: ";
std::getline(std::cin, first_name); // gets user’s string input

std::cout << "Enter last name: ";
std::getline(std::cin, last_name);


void introduction(std::string first_name, std::string last_name) // displays to console the bond intro
std::cout << last_name << ", " << first_name << " " << last_name << "\n ";

int main()
std::string first_name, last_name;

getname(first_name, last_name);         // calls getname function
introduction(first_name, last_name);    // calls introduction function


//////////////////////////////basic version

void introduction(std::string first_name, std::string last_name){
std::cout<< last_name << ", "<< first_name << " "<< last_name;

int main(){

introduction(“james”, “bond”);