Inactive Tutor answered 3d
Tutor
New to Wyzant
You cannot do this directly. In C, you cannot accept raw arrays by value (it decays to a pointer). However, in this case, the typedef is unable to decay to a pointer, and so you get an error. The way to get around this limitation is to use a struct.
typedef struct {
char data[3];
} type24;
int32_t type24_to_int32(type24 val) {
// Access bytes using val.data[0], val.data[1], etc.
}
void foo(type24 val) {
// Passed by value safely
}