This code is part of a semaphore code, but what does line 2 until the end mean?
Are they treating this part as an structure?
I assume that int sid; has no purpose. Any ideas?
Thank you!
'int sid;' is just a normal declaration of integer variable sid. The ';' should tip you off.
What the wrapping of the code in {}'s does, is that the code only 'lives' between the {}'s.
I don't see why it would make any difference here, but for example, if you would declare a variable in between those {}'s, and use that same variable later outside the {}'s, the variable would be out of scope.
Ow lol, didn't even see that one, because I got distracted by the weird use of brackets. The integer 'sid' is declared AFTER it is 'used'. You need to put line 2 before the first line.