c declaraing varibles in blocks
- by anon
I know that in C++, I can declare variables pretty much everywhere.
I recall once reading that in C, variables must be declared at the top of a function i.e. the following is invalid:
void foo() {
int good;
if (...) {
int bad;
}
}
In the above code, is the declaraing of the bad varaible legal by C standards, or only legal due to a gcc extension?
Thanks!