From: Scott D. <sc...@da...> - 2001-10-31 21:26:56
|
On Wed, 31 Oct 2001, Sandeep Dutta wrote: > Johan, > > I'm still confused .. why does char2 inside the loop have a > global scope it has been declared in function ... > void c1(void) > > > { > > > char2 = 9; Sandeep, "char2" is not declared in the scope of c1. It was declared globally and only assigned within c1. > > > > > > for(i=0;i<4;i++) { > > > c2(); > > > char1=char2; <<== should be 9 > > > char0+=char1; > > > > > > } > > > } The problem here is that the function c2() changes the contents of char2. However, the function c1 is using its locale copy of char2 to add to char1. Scott |