Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c

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 }).

like image 219
Sven Avatar asked Mar 09 '12 11:03

Sven


1 Answers

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

like image 167
Fred Foo Avatar answered Nov 15 '22 21:11

Fred Foo