Oh, for Pete's sake.
I gave one approach (calling a function that returns a pointer) in Post #4 of this thread we're in which you clearly haven't even tried to understand.
If you don't want to...
Type: Posts; User: grumpy
Oh, for Pete's sake.
I gave one approach (calling a function that returns a pointer) in Post #4 of this thread we're in which you clearly haven't even tried to understand.
If you don't want to...
Then do something like this
/* declarations of CAN_A and CAN_B must be global, so they exist outside readPort() */
struct FLEXCAN2_tag *readPort(Port Number)
{
switch (Number)
{
Remove the const qualifier and/or return the required value from the function.
There are other possibilities (moving it to other places in the definition) but you haven't given enough information...