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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:40:45+00:00 2026-05-25T13:40:45+00:00

As part of a C programming project I’m doing, I’ve needed to create my

  • 0

As part of a C programming project I’m doing, I’ve needed to create my own dynamic array system.

As my array system copies the data from a pointer when adding an object, I would like to keep the overhead down by passing a pointer to an object that was loaded in the function, as opposed to loading the object statically and copying the memory by adding it to the array after.

I just can’t understand why this won’t work:

some_obj_ptr = (OBJTYPE *)array_push(obj_list_ptr, &(load_item_from_file("rsrc\\item.txt")));

Is there something similar I could do? The compile error I get for that line is

lvalue required as unary '&' operand.

The prototype for my array_push functon is:

void *array_push(ARRAY *array, void *object);

Any ideas?

LJ

  • 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-25T13:40:45+00:00Added an answer on May 25, 2026 at 1:40 pm

    The return value of a function is temporary, it’s not a named object (crudely speaking, that’s the definition of an lvalue). You can’t take the address of a temporary object, because it doesn’t really exist.

    You can, of course, return a pointer from a function.

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

Sidebar

Related Questions

While programming, the longest part is a build on my ASP.NET Website project is
As part of a recent programming project I compiled a database, the contents of
I'm developing a parents evening booking system as part of my A level programming
As part of another question that did involve programming (I assure you), someone suggested
R is a statistics programming language. Part of R is the use of Packages,
I've been doing .NET and C# programming for quite some time, but this is
I'm really tempted to drop RegexKit (or my own libpcre wrapper) into my project
I am working on a personal project involving some jQuery / native Javascript programming.
My goal is to hop on to C++ programming language by doing a homework
As part of my project I need to read the kernel to get the

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.