C - Setting a struct to null (incompatible types in assignment)

后端 未结 4 1838
旧时难觅i
旧时难觅i 2021-02-10 02:46

I have the following struct:

struct elem {
  int number;
  char character;
};

struct item {
  struct elem element;
};

and the following functi

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-10 02:49

    1. element is not a pointer and hence cannot be assigned NULL.
    2. main->element is wrong usage. You cannot access a structure's element using it's name. It should be wrapper->element. You should access it using the variable name.

提交回复
热议问题