#include <stdio.h>
#include <string.h>
#include <stddef.h>

struct my_type_t {
    int x;
    int y;
    int z;
};

struct my_array_t {
    struct my_type_t test;
    int otherstuff;
};

void somefunction(struct my_array_t *arrayofstructs, size_t offset, int value) {
    int i;
    for (i = 0; i < 5; i++) {
        //Unfortunatly can't do straight assignment not a lvalue
        //if you just want to use the member as a rvalue (basically not assignment) can do so normally
        memcpy((((void *)&arrayofstructs[i].test) + offset), &value, sizeof(value));
    }
}
int main(void) {
    struct my_array_t arrayofstructs[5];
    somefunction(arrayofstructs, offsetof(struct my_type_t, x), 1);
    somefunction(arrayofstructs, offsetof(struct my_type_t, y), 2);
    somefunction(arrayofstructs, offsetof(struct my_type_t, z), 3);
    
    int i;
    for(i = 0; i<5; i++) {
        printf("Struct %d: X = %d, Y = %d, Z = %d\n",i,arrayofstructs[i].test.x \
                                                      ,arrayofstructs[i].test.y \ 
                                                      ,arrayofstructs[i].test.z);
    }

    return 0;
}

