On Sat, 31 Jan 2009, chiluveru snehith wrote:
> in Cu can declare a variable outside but u should extern key word
> before it"extern
> int i;"
> u can't intilize the the variable outsideas i=5; this is wrong
> if u want intilize it make it as static
> "static int i=5;"
> in C++
> u cant declare variables outside outside ,if u want to declare use extern
> key word
> otherwise declare it in one class the class as default constructor in it
> it will automatically initilize the variable inside the class
>
How does this piece of code work then ?
// ------------------------------
#include <iostream>
int i = 5;
int main(int argc, char *argv[])
{
return 0;
}
// ------------------------------
thanks
Saifi.