Writing/Reading struct w/ dynamic array through pipe in C
- by anrui
I have a struct with a dynamic array inside of it:
struct mystruct{
int count;
int *arr;
}mystruct_t;
and I want to pass this struct down a pipe in C and around a ring of processes. When I alter the value of count in each process, it is changed correctly. My problem is with the dynamic array.
I am allocating the array as such:
mystruct_t x;…