printf() changing treatment of variable in C -


I have a very simple task in my program using Sect method to find the root of the function. I printf (), Which is indicated below. But if I comment on it, the loop repeats again. I do not know why ...

I've read printf to change one variable, but I do not see anything on it that changes the storage of the variable. Am I forgetting something? This is not a great solution to print, since the iterations are not important and the function is called millions of times.

  Double estimate 1 = 500.; Double y1 = estimator (r, quantity, estimate 1, adamin, tm, rr [r]); Double Estimate 2 = Ed / 30.; Double y2 = estimator (r, quantity, estimate 2, adamin, tm, rr [r]); Int i; Double estimate 3 = 0.; Double y3; Double tol = heightTOL; Int secmax = SECANTMAX; For (i = 1; i & lt; = secmax; i ++) {guess3 = estimate 2-y2 * (hypothesis 2-estimate 1) / (y2-y1); If (Estimate 3> adm / 2). {Guess3 = adm / 2 ;; } If (Estimate 3 & lt; = 0.) {Guess3 = 0 ;; } Y3 = Estimator (R, Quantity, Estimate 3, Admin, TM, RR [R]); Y1 = y2; Y2 = Y3; Guess1 = guess2; Guess2 = guess3; If (Fibs (Estimate 2-estimate 1) & lt; tol) {Break; } If (i == secondsmax) {printf ("\ n Exit the iterations in the height finder \ n"); } Printf ("% d% f", i, estimate 3); // it here !!!!!!!! } Return estimate 3; Your data is not changing at all.    

printf The function of a function of the printf family is the only way to have an effect on your data, if you use the % n format specification (which is written in the variable If you are doing something like that) or if you are doing something that undefines the wrong behavior, such as passing wrong form arguments, you are not here from those things (your format strings are correct), so your bug Otherwise Su is located.

Check that you have all your access to try to run your code in Valgrind or other assumptions to try to find memory errors.

Comments