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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:34:23+00:00 2026-06-04T09:34:23+00:00

I was under the impression that any function in C would support only one

  • 0

I was under the impression that any function in C would support only one return statement until I came across a few notes where there was a mention of multiple return statements. How do these multiple return statements work?

  • 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-06-04T09:34:26+00:00Added an answer on June 4, 2026 at 9:34 am

    The first return statement that is executed will terminate the function and its value will be used.

    However, there can obviously be multiple execution paths – and they can return different values. Actually in a non-void function every possible execution path has to return something. The easiest way to achieve this is obviously having a return statement at the very end of the function.

    if(foo)
        return 23;
    else
        return 42;
    

    There are some arguments for having just a single return statement in your code; consider reading the article if any of them apply to you. A good example is code that always needs to do some clean-up. In this case you will only want to return after this has been done – so you’ll set a variable for the return value and use goto to jump to the cleanup-and-return section at the end of the function if you need to return early.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Going through the XPath.compile API, I was under the impression that it would return
I was under the impression that I could put any old executable program in
I had until recently been under the impression that the CDbl(x) operation in VB.NET
So I was under the impression that any mistake made in programming could quite
I was under the impression that the css rules in the callback function below
I was under the impression that using the Resolve method returned a new instance
I was under the impression that when you double click a file (or choose
I was under the impression that if I deployed my application (using Ant) then
I was under the impression that this was formed correctly, but here it is
I was under the impression that jQuery is JavaScript Framework, but when am searching

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.