Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Tue, 27 Aug 2002 20:40:37 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Cynthia Randles cc: cygwin AT cygwin DOT com Subject: Re: cygwin gcc and arrays -- Possible bug??? In-Reply-To: <3D6C06A3.9B2A7853@princeton.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Which version of gcc are you using? Which libraries are you linking in? How are you allocating/declaring rad_array and vol_array? Is this a C or C++ program? Please also check your loop limits - are you sure you wanted a '<=' there, rather than a '<'? Igor On Tue, 27 Aug 2002, Cynthia Randles wrote: > I was wondering if anyone could help me. > I have the following lines of code: > > for (i = 0; i <= NUMBINS; ++i) > { > printf("--------read in input files---------\n"); > printf("The value if i is %d\n", i); > fscanf(ifp1, "%f\n", &radius_microns); > fscanf(ifp2, "%f\n", &volfraction); > printf("The value of radius is %f\n", radius_microns); > rad_array[i]= radius_microns; > > printf("The radius is rad_array[%d]=%f\n\n",i, rad_array[i]); > > printf("The value of volfraction is %f\n", volfraction); > vol_array[i] = volfraction; > printf("The volfraction is vol_array[%d]=%f\n", i, vol_array[i]); > printf("The value of rad_array[%i] is %f\n", i, rad_array[i]); > printf("----------end of read in input file------\n\n"); > } > > which, in cygwin produces: > > --------read in input files--------- > The value of i is 0 > The value of radius is 0.200000 > The radius is rad_array[0] = 0.200000 > > The value of volfraction is 0.330000 > The volfraction is vol_array[0]=0.330000 > The value of rad_array[0] is 0.330000 > ----------end of read in input file----- > > as you can see, for some reason rad_array[0] is being reassigned even > though I never ask for that!!! > > my red-hat linux gcc produces: > > --------read in input files--------- > The value of i is 0 > The value of radius is 0.200000 > The radius is rad_array[0] = 0.200000 > > The value of volfraction is 0.330000 > The volfraction is vol_array[0]=0.330000 > The value of rad_array[0] is 0.200000 > ----------end of read in input file----- > > which is the right answer. I cannot figure out what is going > on with cygwin, and I haven't found a post that can help me. Any > help is appreciated. > > Thanks, > Cynthia -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! It took the computational power of three Commodore 64s to fly to the moon. It takes a 486 to run Windows 95. Something is wrong here. -- SC sig file -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/