Re: Scope resolution in C
- From: "Abhi" <abhisheksgumadi@xxxxxxxxx>
- Date: 30 Dec 2006 08:09:01 -0800
Referring to the post given by MR herald,
If the statements
int *ap = &a;
static int a = 10;
are reversed, wont the results for a be the same.. I think this answer
should be given independent of the order in which the declarations are
done and I think the right way of doing it is by using the function to
access it as global.
With Regards,
Abhishek S
Mark McIntyre wrote:
On Fri, 29 Dec 2006 06:51:05 -0500, in comp.lang.c , CBFalconer
<cbfalconer@xxxxxxxxx> wrote:
Mark McIntyre wrote:
Having two identically named variables with different scope is a
design error. To fix it, rename one of the variables.
It's not a design error.
Er? Its a design error if you need to access the outer scope variable.
It is a valid technique for protecting
the outer scope variable from modification (or access) within the
inner scope.
Sure, but hte OP wanted to do the reverse.
--
Mark McIntyre
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
.
- Follow-Ups:
- Re: Scope resolution in C
- From: Barry Schwarz
- Re: Scope resolution in C
- References:
- Scope resolution in C
- From: Subra
- Re: Scope resolution in C
- From: Mark McIntyre
- Re: Scope resolution in C
- From: CBFalconer
- Re: Scope resolution in C
- From: Mark McIntyre
- Scope resolution in C
- Prev by Date: Re: c / c++ : is it end of era ?
- Next by Date: Re: c / c++ : is it end of era ?
- Previous by thread: Re: Scope resolution in C
- Next by thread: Re: Scope resolution in C
- Index(es):