FAQ: Functions - Void — The Point of No Return

This community-built FAQ covers the “Void — The Point of No Return” exercise from the lesson “Functions”.

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

Learn C++

FAQs on the exercise Void — The Point of No Return

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!

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

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

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!

Would have been helpful if you stated explicitly that you did not want us to print the quotation marks around the oscar wilde quote. I just spent ten minutes looking for a bug in my code that wasn’t there.

2 Likes

Try again using:
void oscar_wilde_quote(){
std::cout << “The highest, as the lowest, form of criticism is a mode of autobiography.\n”;
}

2 Likes

i wrote the quote wrong :joy:

1 Like

Inside of main() , call `oscar_wilde_quote() I dont know wat to do can someone help me

You need to std::cout a string in the function oscar_wilde() and then call that function inside the int main().

1 Like

It would be nice to know that you don’t need to enter return before function because all previous examples had return marked as a blue operator before declared function. This was very off-putting!

I can’t understand this: Inside of main() , call oscar_wilde_quote(). Can anybody help me? :confused:

int main() {
// Call your function here:

oscar_wilde_quote() ;

}

Cannot understand this topic.What happens after calling that function again?

When you define a function, nothing happens. So, when you define the oscar_wilde_quote() function and then run the program, you will see nothing being printed to the console.

It is when you actually call the function that the instructions within the function are executed. When (in your main function) you call the oscar function, that is when the std::cout statement within that oscar function is actually executed and you will see the quote being printed to the console.

Think of it like cooking. When you define a function, you are writing a recipe in your notebook but aren’t doing any cooking. When you call that function, then you are actually cooking by enacting the steps outlined in the recipe.

1 Like

I don’t know what I’m doing wrong
I’ve been trying this lesson for half an hour, and nothing works. This is what I have so far

#include

// Define oscar_wilde_quote() below:
void oscar_wilde_quote(){
std::cout << “The highest, as the lowest, form of criticism is a mode of autobiography.\n”;
}

int main() {

// Call your function here:

}

If someone could tell me what I’m doing wrong and give the correct thing, I would appreciate it.

You have completed Step 1 of the exercise i.e. defining the function.
Step 2 asks you to call this function from main(). Note the comment // Call you function here: which points out where in main you are supposed to call the function you have defined. To call a function with no parameters, you just do function_name() where function_name should be replaced by the name of the function you are calling.

1 Like

When I hit the “Show answer” button, all it added was white space in between all my lines.

okkayyy I see why everyone is getting stuck… my problem should be similar to others, instead of writing block of code

-void oscar_wilde_quote() {
std::cout << “The highest, as the lowest, form of criticism is a mode of autobiography.\n”;
}

-int main(){

make sure you read the instructions and place that block of code above int main(){

and don’t forget to call your function under int main(){
//write here
}