0d: 00h: 00m: 00s

🎁 Get 3 extra months of learning — completely FREE

That's 90 extra days to master new skills, build more projects, and land your dream job.

Become a PRO
Background Image

🎁 Get 3 extra months of learning completely FREE

Become a PRO
Ivan Cosmas
last week
Ivancountry asked

Does printing \n in C count as returning, or does it just move the text to a new line?

Abhay Jajodia
Expert
last week
Abhay Jajodia answered

Hello Ivan, really nice question.

It’s easy to mix up the idea of a function “returning” with what \n does in a print statement. They sound similar, but they’re completely different things.

When you write:

printf("Hey\nHow are you?");

the \n does not return from the function. It doesn’t stop anything, and it doesn’t exit the print. All it does is tell the output: start a new line here. So the text comes out like this:

Hey
How are you?

The printing continues normally after the newline.
A real return is something you do with a return statement inside a function, not with \n.

If you want more examples or want to see how multiple \n behave, I’m happy to show you.

C
This question was asked as part of the Learn C Programming course.