may be you are using a local glob_index in the change_glob_index() function. for clarity use g_. also you may try using macros like INCGLOB ++glob_index, DECGLOB --glob_index. There is no harm in using globals. It improves effciency etc. But its good practice to have wrapper functions/macros to access or modify globals. The wrappers may be inlined to eliminate the calling overhead. devraj On Fri, 16 May 2003 Julien Patrick Claassen wrote : >Hi! > My unhappiness. I want to use a global variable for counting >up an >array-index. But now all functions that deal with my array have >to get it as >a parameter. That makes me unhappy, because most of them, don't >even do >something with it directly (they may just pass it along for >another >"subfunction" they call. Besides, I thought there was a way to >declare a >global variable, that is known everywhere and can be changed >everwhere. Being >changed meaning, changing it globally. I simply tried it with >something like: > >#include >int glob_index; >(functions here using glob_index); >int main() >{ > glob_index = 6; > change_glob_index(); // being a function that manipulates >glob_index > return 0; >} > > I used some simple output to see the value of glob_index and >saw, that it is >only changed locally. > Is there a - let's say - more elegant way of doing this? Or is >my way the >usual? > Kindest regards > Julien > > >Julien Patrick Claassen >jclaassen@gmx.de >julien@c-lab.de >http://www.geocities.com/jjs_home > >SBS C-LAB >Fuerstenallee 11 >33102 Paderborn > >Phone: (+49) 5251 60 6060 >Fax: (+49) 5251 60 6065 > >www.c-lab.de >_______________________________________________ >This is the Linux C++ Programming List >: http://lists.linux.org.au/listinfo/tuxcpprogramming List