S
sushant
hi ,
can we use scope resolution operator in C???
sushant
can we use scope resolution operator in C???
sushant
sushant said:hi ,
can we use scope resolution operator in C???
sushant said:can we use scope resolution operator in C???
can we use scope resolution operator in C???
sushant said:hi ,
can we use scope resolution operator in C???
Derrick said:The only reason to do so would be to access some member of a namespace
or class - neither of which C has.
i want to access the value of global variable inside the main function
and inside the main func the var with the same name is available..for
eg.
int x=20;
main()
{
int x=10;
printf("%d",x);
}
NO.i want to access the value of global variable inside the main function
and inside the main func the var with the same name is available..for
eg.
int x=20;
main()
{
int x=10;
printf("%d",x);
}
i want the o/p to be 20.. how can v achieve that?
i want to access the value of global variable inside the main function
and inside the main func the var with the same name is available..
i want to access the value of global variable inside the main function
and inside the main func the var with the same name is available..for
eg.
int x=20;
main()
{
int x=10;
printf("%d",x);
}
i want the o/p to be 20.. how can v achieve that?
i want to access the value of global variable inside the main function
and inside the main func the var with the same name is available..for
eg.
int x=20;
main()
{
int x=10;
printf("%d",x);
}
i want the o/p to be 20.. how can v achieve that?
Ben said:main()
{
int x = 10;
{
extern int x;
printf ("%d", x);
}
...
}
Erik said:You can't. In fact the above code should be considered a potential
cause of bugs. If you are lucky enough to be using the GNU C compiler
(gcc) you can avoid these bugs by compiling with the -Wshadow
compiler flag. Add -Werror will turn warnings into errors.
Erik
Is the one below at fault ?CBFalconer said:A foul construct indeed. What happens if the local to main x is
declared static? I.e. how does the extern actually get resolved.
sushant said:hi ,
can we use scope resolution operator in C???
sushant
Ben Pfaff wrote:
....
A foul construct indeed. What happens if the local to main x is
declared static? I.e. how does the extern actually get resolved.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.