Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using memb to allocate memory for a struct containing an array #2703

Open
teo-jun-xiong opened this issue Apr 10, 2022 · 0 comments
Open

Using memb to allocate memory for a struct containing an array #2703

teo-jun-xiong opened this issue Apr 10, 2022 · 0 comments

Comments

@teo-jun-xiong
Copy link

teo-jun-xiong commented Apr 10, 2022

I have the following struct:

struct A {
  int size;
  double a[5];
}

When I do the following to allocate space:

MEMB(rssiarray, struct RssiArray, 5);
memb_init(&rssiarray);
struct A* a = memb_alloc(&rssiarray);
a->size = 0;

I am not able to read the array inside. What am I doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant