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 8792045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:55:33+00:00 2026-06-13T22:55:33+00:00

Possible Duplicate: returning multiple values from a function I’m trying to make a doubly

  • 0

Possible Duplicate:
returning multiple values from a function

I’m trying to make a doubly linked list in C. I have a main function that calls another function to create nodes and build the list. I need this last function to return two different pointers (one to the start and one to the end of the list) to main.
Is there a way to use “return” to return two things? In this case two pointers.
I thought in returning a structure with two elements, the two pointers. But is there an easy way?

This is how I call the function (insertacomienzo) in the main:

primero = insertacomienzo (primero, ultimo, tamaniomax);

(primero is a pointer)
And the function returns this pointer now modified.

return primero;

What I need is to return now two pointers, one is the one pointing to the start of the list, and the other is pointing to the end of the list.

Thank you!

  • 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-13T22:55:33+00:00Added an answer on June 13, 2026 at 10:55 pm

    Use InOut parameters to give back any extra parameter (this is how it’s usually done in C).
    InOut parameters are of type ‘*‘ instead of just ‘‘ (in CPP they are of type ‘&*’ but you don’t have ‘&’ in C)

    Here is a prototye of a inout function

    node* GenerateList(node* currentListItem,node** InOutLastListItem,int currentNodes)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: returning multiple values from a function Suppose i have passed two values
Possible Duplicate: returning multiple values from a function For example if you want a
Possible Duplicate: Returning multiple values from a C++ function /************************************************/ /* Name: premserv */
Possible Duplicate: Why can you return from a non-void function without returning a value
Possible Duplicate: Returning a value from thread? I have this code: //Asynchronously start the
Possible Duplicate: Is returning a string literal address from a function safe and portable?
Possible Duplicate: Why is this function returning “undefined”? Let's assume I have the following
Possible Duplicate: Why can you return from a non-void function without returning a value
Possible Duplicate: returning UIImage from block Hi I'm trying to return dictionary of json
Possible Duplicate: python - returning a default value I have a function in a

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.