Help please I am trying to output a value of an array, for example I want to output 7. How do I do it? Here's the code:

{
	class Program
	{
		public static void Main(string[] args)
		{
			double [] kush = new double [2] {5.2,7};
			
			Console.WriteLine(kush[2]);
			
			
			
			
			Console.ReadKey(true);
		}
	}
}

I can't seem to get this working, what is my mistake ???

Arrays are numbered from zero up, so your line 6 creates an array with elements [0] and [1].

That should be enough for you to fix your problem.

Arrays are numbered from zero up, so your line 6 creates an array with elements [0] and [1].

That should be enough for you to fix your problem.

oh thanks and sorry for such a stupid question I thought I need to add an additional syntax for it but, oh well thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.