c# - Exclamation Storing multiple function calls in an array -


itemprop = "text">

Assume my function with 2 values ​​as an integer array, race [0] and race [1] < P> When I am calling the array in the loop for several times, and when I am storing results in another array, results in each iteration are over-written with new results.

If the first call [0,1] returns, the array will store the [0] and [1] index, which is fine, but when I'm calling the function again, new results It is stored on the same index [0] and [1] I think how to avoid

Function Code:

  Private Zero MatrixMul (string subInput, Int [,] key, int [(integer col = 0; col & lt; key.GetLength (0); line ++) {for};) result {{int row = 0; GetLength (0) for col ++) {Results [line] = well Mr. [line, color] * AtoZ.IndexOf (Sbinput [col]); }}}   

Calling code:

 for  (int i = 0; i & lt; outPut.Length; i ++) {MatrixMul ( Production [i], keys, anchors); For example, in my output, the following are: "TH", "IS", "AT" when I am calling the function with the first element of "TH" Then converts "T" to its equivalent number and applies some calculations with "H". Let the last answer be 30 for "T" and 30 for "H". The problem is that each time, the Incorrect Index 0 and 1: encicures will accumulate values ​​at [0] = 20 encrypts [1] = 30, when I call the function again, it will store the new value in 0 and 1. .. That's because I'm not converting the encchars index value on each call, so I guess that?   

If you want to add values ​​to the given array, Do not create new, but declare it as a parameter and modify the values.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -