Declaring Variable

Can we Declare a variable between the closing paranthesis of a function and opening curly brackets??

like

////////////////////////////////////////

void bar()
int x;
float y;
{
}

/////////////////////////////////////////////

Because I am using g++ compiler and getting error.....

Thanks...
Why would you ever want to do that? And no, you can't do that...
That's [almost] the really ancient C way to do pass parameters. IIRC C used to look like this:

1
2
3
4
5
void bar(x,y)
int x;
int y;
{
}


But it hasn't been that way for decades.

As LB said, there's no reason for it. Just put your variable definitions in the braces like you're supposed ot.
Oh I C.... Thanks..... That was in a book...... So Just tried.....
Topic archived. No new replies allowed.