I’m not a newbie C programmer (nor an expert), but I’m still puzzled by the following problem: I use the code below (a very simplified version of my code) to declare, assign value to, and print the value of an int variable. I have searched my full C program to ensure that the value of nsteps isn’t being changed anywhere else in the code:
Code:double myfunc(args){ int j, nsteps = 200; for(j = 0; j = nsteps; j++){ … printf(“value of j = %d, nsteps = %d.\n”, j, nsteps); … } }
The values that print are j = 0 and nsteps = -2147483648. Again, nsteps is used in a couple of other places later in this function, but its value is never changed from 200 anywhere in the code.
Does anyone have a suggestion about what might be causing this nonsensical value to be assigned to nsteps? Thanks in advance for your input.



LinkBack URL
About LinkBacks




