cancel
Showing results for 
Search instead for 
Did you mean: 

struct pointer in SPC563Mx

Mina
Associate II

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Mina
Associate II

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! 

 

View solution in original post

1 REPLY 1
Mina
Associate II

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!