I have seen this done in some code samples and seen Salem saying that its not allowed in standard C. What I was wondering is when is memory allocated and what the lifespan of the variable is when it is declared after statements.
example:
Could blah3 be used in case 3? case 1?Code:int foo (void) { int blah, blah2; blah = something; switch (blah) { case 1: blah2+=1; break; case 2: int blah3; blah3=blah * blah; break; case 3: blah2=ok; break; } return 0; }
I personally dont like it but I'd like to know how it works none the less.



LinkBack URL
About LinkBacks


