mardi 4 août 2015

C unknown syntax for variable declaration [duplicate]

This question already has an answer here:

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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire