2023-07-18 12:11 AM
Dear experts,
I am encountering an issue while assigning a value to an element of a struct that I'm using a pointer to access. The code compiles successfully and programs on our SPC563Mx MCU board. However, when attempting to assign a value to a specific element, the code does not function as expected. I'm wondering if there are any limitations or restrictions that I might be overlooking. Here is a snippet of the code I'm working with:
typedef struct _s1
{
s2 registers; // another struct inside this struct
bool writeCmd;
bool readCmd;
}s1;
in main.c, I have:
s1* ps1; // global
ps1->writeCmd = 1;
If there are no inherent limitations, I would greatly appreciate your assistance in identifying the problem.
I would appreciate any insights or guidance regarding this issue. Thank you!
Solved! Go to Solution.
2023-07-18 05:19 AM
I found the problem! I've had an error with malloc() function, so I've had commented it and forgot to resolve that! so my pointer was pointing to nothing!
2023-07-18 05:19 AM
I found the problem! I've had an error with malloc() function, so I've had commented it and forgot to resolve that! so my pointer was pointing to nothing!