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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:31:33+00:00 2026-05-27T22:31:33+00:00

I have a function: *Foo* create_foo(); where Foo is a struct with many fields:

  • 0

I have a function:

*Foo* create_foo();

where Foo is a struct with many fields:

typedef struct foo {
    int progr_num;
    char* size;
    char* account;
    int matric_num;
    int codex_grp;
    char* note;
} Foo;

What is the exactly return value of this function when I call it??

the function:

Foo create_foo() {
    Foo x;
    ...
    ...
    return x
}

I know that the return type is Foo, but if I invoke the function and want to test the return value, which is the correct value?? (for example if a funcion is an int type, the return is 0 or -1).

When I call the function what is the return correct value??

for example:

int main() {
    Foo foo_check;
    foo_check = create_foo();
    if(!foo_check)
    return ... **???**
}
  • 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-05-27T22:31:33+00:00Added an answer on May 27, 2026 at 10:31 pm

    Rather than passing the (large) struct back and forth on the stack, pass a pointer and use the stack for a status indicator.

    struct foo { /* ... whatever ... */ };
    int fxfoo(struct foo *pfoo) { /* ... whatever ... */ return ALLOK?0:1; }
    int main(void) {
        struct foo objfoo;
        if (fxfoo(&objfoo)) /* error */;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a variadic function foo(int tmp, ...) , when calling foo
I have a data structure like this: struct foo { int id; int route;
I have a loop created with each, check this example: $('.foo').each(function(i){ //do stuff });
Suppose I have virtual function foo() in class B, and I need slightly different
If I have a function foo() that windows has implemented in kernel32.dll and it
Say I have a function foo: (defun foo (x y &rest args) ...) And
Say I have a function foo that I want to call n times. In
In my script, I have a function foo which basically uses pynotify to notify
I have a ColdFusion function foo which takes three args, and the second two
Say I have the following function: foo <- function(x, y = min(m)) { m

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.