Search code examples
iosobjective-ctypedefshort

short array in typedef struct in Objective-C


typedef struct
{
short data[];

short sampleData[];

BOOL sample[];

}customMembers;

I declared like this but I am getting error like following

"Filed has incomplete type short[]"

Please help me


Solution

  • You must provide a length like this short data[42] for your arrays or define it as a pointer short *.

    If not, the size of the struct would be unknown.

    See C: differences between char pointer and array for more informations about the difference between the two.