I'm doing some excercises for school and ran into a problem. When I try to count the characters in a array it just gives back the array itself. Can anyone tell me what I'm missing? The code is in C#.
public static int CountFor(int n)
{
int count = 0;
int[] a = new int[] {n};
for (int i = 0; i < a.Length; i++)
{
count += i;
}
return count;
}
and in the main to show the results:
Console.WriteLine(CountFor(1024));
Console.ReadKey();