I'm writing a function that is supposed to add a Product object to an array of Products and also initialize the data members for each Product object. I'm running into an issue where I can't figure out how to initialize my name and category data members, both of which are an array of characters and would appreciate some help. I tried changing the parameters to things like 'char[] name' or 'char name[]' but it's not working out.


I'm trying to compile my program below but I keep getting the errors:
Code:
    store.c: In function ‘addProduct’:
    store.c:24:40: error: assignment to expression with array type
      productArr->products[productArr->numProducts]->name = name;
                                            ^
    store.c:25:33: error: ‘ProductType {aka struct <anonymous>}’ has no member named ‘category’
      productArr->products[productArr->numProducts]->category = category;

store.c

Code:
    int addProduct(ProductArrType* productArr, char name, char category){    
        productArr->products[productArr->numProducts] = malloc(sizeof(ProductType));
        productArr->products[productArr->numProducts]->name = name;
        productArr->products[productArr->numProducts]->category = category;
        return 1;
    }

defs.h

Code:
    #define MAX_RUNNERS  10
    #define MAX_STR  30


    typedef struct {
      char category[MAX_STR];
    } EntityType;


    typedef struct {
      char name[MAX_STR];
    } ProductType;


    typedef struct {
      int numProducts;
      ProductType *products[MAX_PRODUCTS]; 
    } ProductArrType;