I came across one project,where I found some code which I is not understandable to me. I just started with C++
, so it seems like a big problem for me. I am providing few lines of my project,which I am not able to understand.
class abc
{
public:
//some stuff
abc();
};
abc::abc()
{
int someflag = 0;
//code
if(someflag == 0)
{
do
{
//few strcpy operations
{ //(My Question)Without any condition braces started
//variable initialization
}
}while(condition);
}
}
Now my questions...
do-while
loop?do-while
loop?Help me to understand this.
You introduce a scope block for the variables inside.
See above.
The variables go out of scope at the end of the braces, they're there for that sole reason. One use case I can think of for this is a scoped_lock
or something similar to it for multi-threaded applications.
No.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With