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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:00:33+00:00 2026-06-11T21:00:33+00:00

I have this C code for a Point structure: typedef struct Point{ int x,

  • 0

I have this C code for a Point structure:

typedef struct Point{
 int x, y;
} Point;

void one(Point P) {
 p.x = 1;
 p.y = 1;
}

I would like to make a pointer to an array of 50 points and then pass these some of the array members to the one function.

I tried

struct Point (*mypointer)[50];
one(mypointer[i]);

but got “expected ‘Point’ but argument is of type ‘struct Point'”
I then tried deferencing the pointer

one(&mypointer[i])

but got “expected ‘Point’ but argument is of type ‘struct Point (*)[(long unsigned int)N]”
What should I do? Thanks.

  • 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-11T21:00:34+00:00Added an answer on June 11, 2026 at 9:00 pm

    That’s because argument for function one is not a reference to a structure but just real data (which is allocated on the stack).

    Try by using:

    void one(Point *p) {
     p->x = 1;
     p->y = 1;
    }
    

    In any case the array declared as struct Point *mypointer[50] is not an array to points but an array of pointers to points (which you have to allocate one by one). If you wish to have just an array to points you should use

    Point points[50];
    one(&points[i])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have something like this in my code: void f(struct foo *x, struct
I have this code that I want to make point-free; (\k t -> chr
I have this structure typedef struct fpinfo { unsigned long chunk_offset; unsigned long chunk_length;
I have this code: public class Area { Texture2D point; Rectangle rect; SpriteBatch _sB;
I have found this code for reverse geocoding: var point = new GLatLng (lat[1],long[1]);
Up to this point, I have used the following code to restrict the application
Ok, so i have a HTML structure like this: <div class=content> <div id=a1 class=article>
I have 2 classes: one basic and one derivative. Also have structure. struct D;
I have the following for my HashTable structure: typedef char *HashKey; typedef int HashValue;
So, I have some code, kind of like the following, to add a struct

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.