int L = 2;
int M = 0;
for (int i = 1; i <= 6; i++)
{
foreach (char c in ListLines[L])
{
if(c == 'A')arrayOne[M]++;
if(c == 'B')arrayTwo[M]++;
if(c == 'C')arrayThree[M]++;
}
L =+ 2;
M++;
}
Hi!
I'm learning C# at the moment, and I'm trying to create a for loop for my arrays.
All I need to know really is can I create an integer (int M) and use that to define the object in the array? For example, arrayOne[M]?
As this will allow me to create a counter for it that will let me create a loop.
Mrepresent? why are you using that instead of the existing loop variablei? what does "same outputs for every object" mean? please show exactly the input for the code, and explain exactly what the output is and how that's different from what you wanted. See stackoverflow.com/help/mcve and stackoverflow.com/help/how-to-askint[][] array. So you can access it likearray[1][M]++.