Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Practicing Array Declaration | Arrays
C# Basics
course content

Conteúdo do Curso

C# Basics

C# Basics

1. Getting Started
2. Dealing with Data Types
3. Control Structures
4. Loops
5. Arrays
6. Methods

bookPracticing Array Declaration

Create an empty array called heights of type float and length (size) of 7.

It's fine if you don't understand the code after the array declaration. It will make more sense in the next chapter.

cs

main

copy
12345678910111213141516
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { // Declare an array below this line ___ heights[5] = 181.9f; Console.WriteLine(heights[5]); } } }
  1. The syntax of declaring an empty array is datatype[] arrayName = new datatype[size];.
cs

main

copy
12345678910111213141516
using System; namespace ConsoleApp { internal class Program { static void Main(string[] args) { // Declare an array below this line float[] heights = new float[7]; heights[5] = 181.9f; Console.WriteLine(heights[5]); } } }

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 5. Capítulo 2
some-alt