C

Asked • 03/30/19

typedef fixed length array?

I have to define a 24-bit data type.I am using `char[3]` to represent the type. Can I typedef `char[3]` to `type24`? I tried it in a code sample. I put `typedef char[3] type24;` in my header file. The compiler did not complain about it. But when I defined a function `void foo(type24 val) {}` in my C file, it did complain. I would like to be able to define functions like `type24_to_int32(type24 val)` instead of `type24_to_int32(char value[3])`.

1 Expert Answer

By:

Inactive Tutor answered • 3d

Tutor
New to Wyzant

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.