This blog shows the code on how to use an array to loop through!!!
using System;
namespace Demo
{
internal class Program
{
private static unsafe void Main()
{
Console.Write("Specify size of array? \n> ");
string userInput = Console.ReadLine();
uint size = uint.Parse(userInput);
long* pArray = stackalloc long[(int) size];
for (int i = 0; i < size; i++)
{
pArray[i] = i*i;
}
for (int i = 0; i < size; i++)
{
Console.WriteLine("Element {0} = {1}", i, *(pArray + i));
}
Console.ReadLine();
}
}
}
How to use an array with an explanation as well
This blog shows on how to use an array with an explanation as well.


Join the conversation! Your thoughts help the community grow.