I'm trying to perform the job that an array is supposed to do, but without actually using one. I was wondering if this was possible, and if it is, how?
I have to initialize different variables, for example:
int value1 = 0;
int value2 = 0;
int value3 = 0;
int valueN = 0;
I want to receive a value from the user that determinate what is the for loop going to last.
Example: User --> 4
Then I can declare 4 variables and work with them.
for (i = 1; i <= 4; i++) {
Console.Write("Insert a number: ");
int value(i) = int.Parse(Console.ReadLine());
}
I expect to have 4 variables called equally, but with the only one difference that each one has a different number added at the end of the name.
// value1 = 0;
// value2 = 0;
// value3 = 0;
// valueN = 0;