Re: [FIXES] 2.1.125

Matthew Hawkins (matt@mail.goldweb.com.au)
Sun, 11 Oct 1998 01:39:22 +1000


On Sat, 10 Oct 1998, Adam Sulmicki wrote:

> [btw: can someone explain me why in linux kernel I can't declare var inside of the proc,
> but instead it has to be at beginning of it. I think in 'normal' c programs you can do that]

*bzzzt*

C++ is the language that lets you define variables anywhere. In C they must be defined
at the beginning of the scope. For example:

int main(void)
{
int foo=2;

yadda();
yadda();

/* you can even do ugly stuff like this */
{
int i=0;

while (i++<foo) {
yadda();
}
} /* the scope of 'i' ends here */

yadda();

return 0;
}

-- 
Matt

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/