pixatlazaki
pixatlazaki

Reputation: 561

What is the meaning of a number in brackets after a struct declaration?

I recently encountered text of the form

struct {
    double a, b, c;
}[123];

What exactly does this do? Is this even proper C?

Upvotes: 3

Views: 211

Answers (1)

haccks
haccks

Reputation: 106012

What exactly does this do? Is this even proper C?

This is an ill formed code. Compiler will raise syntax error. There should be an identifier before [123].

struct {
    double a, b, c;
} a[123];  

This will declare a as an array of 123 struct { double a, b, c; }.

Upvotes: 3

Related Questions