I guess somewhere, you need to determine
int numTreeBranches = 42;
Then later, you can do
mygate->inputs = malloc( numTreeBranches * sizeof(*(mygate->inputs)) );
Then you're free to do
mygate->inputs[x] = ....
I guess somewhere, you need to determine
int numTreeBranches = 42;
Then later, you can do
mygate->inputs = malloc( numTreeBranches * sizeof(*(mygate->inputs)) );
Then you're free to do
mygate->inputs[x] = ....
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
That is for the case of struct gate *inputs[ ] or for struct gates **inputs ???
This data structure is created to represent logic gates input. I have created a program that calculates output of a circuit but can get only 2 inputs at each gate. Now this struct is needed in which Callback f is the function o f logic gate (and, or, nor...) and the **inputs needs to be the input of the gate.