[TABLE="width: 100%"]
[TR]
[TD="colspan: 2"]Hi
I am learning programing, C# and I am on Arrays part. So I have this code and I don't understand.
static void Main(string[] args)
{
int[] n = new int[10];
int i, j;
//initialize elements of array n
for (i = 0; i < 10; i++)
{
n = i + 100;
}
/* output each array element's value */
for (j = 0; j < 10; j++)
{
Console.WriteLine("Element [{0}] = {1}", j, n[j]);
}
Console.ReadKey();
}
Firstly I would like to know, how can I return values of i for loop, without using j for loop.. and why j for loop was used to display output.[/TD]
[/TR]
[/TABLE]
[TR]
[TD="colspan: 2"]Hi
I am learning programing, C# and I am on Arrays part. So I have this code and I don't understand.
static void Main(string[] args)
{
int[] n = new int[10];
int i, j;
//initialize elements of array n
for (i = 0; i < 10; i++)
{
n = i + 100;
}
/* output each array element's value */
for (j = 0; j < 10; j++)
{
Console.WriteLine("Element [{0}] = {1}", j, n[j]);
}
Console.ReadKey();
}
Firstly I would like to know, how can I return values of i for loop, without using j for loop.. and why j for loop was used to display output.[/TD]
[/TR]
[/TABLE]