Dynamically allocate memory for Array of Structs

前端 未结 5 1681
北恋
北恋 2020-12-11 09:34

Here\'s what I\'m trying to do:

#include 
#include 

struct myStruct {
    int myVar;
}

struct myStruct myBigList = null;

vo         


        
5条回答
  •  心在旅途
    2020-12-11 09:58

    Shouldn't the following statement

    myArray[0].myVar = '42'; 
    

    be this?

    (*myArray)[0].myVar = 42;
    

    myvar is an integer.

提交回复
热议问题