Sven
Sven

Reputation: 7645

How is this construct (int) { 1 } called?

How is the construct (int) { 1 } called in C? A guess was "anonymous constant", but this didn't show any helpful on Google. As a sidenote, you can use this construct to tell ioctl that you want to use a variable with the value of 1: ioctl (..., &(int) { 1 }).

Upvotes: 13

Views: 210

Answers (1)

Fred Foo
Fred Foo

Reputation: 363787

It's called a "compound literal" and constructs a temporary int-typed lvalue.

Upvotes: 13

Related Questions