2

I have just come across a piece of code that looks pretty much like this:

int a = ({

    int b = 10;
    b;
});

printf("%d", a);

I've never seen anything like this. It turns out that we can declare a variable this way. But why the language allows this? What is the concept behind it? When it can be of a good use to use such a syntax?

Andrey Chernukha
  • 21,488
  • 17
  • 97
  • 161
  • 2
    See [Are compund statements (blocks) surrounded by parens expressions in ANSI C?](http://stackoverflow.com/q/1238016/1708801) – Shafik Yaghmour Aug 04 '15 at 16:13

0 Answers0