Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it mean when there is a comma inside an array declaration? e.g. float[,]

I have some code I'm trying to understand while learning C#. I do not understand what I even need to search Google for to get here, but the code is as follows:

float[,] heightAll = terData.GetHeights(0, 0, allWidth, allHeight); 

Why does the array declaration have a comma in between the brackets?

like image 922
ricky Avatar asked Dec 10 '12 19:12

ricky


People also ask

How do you declare an array in C?

To create an array, define the data type (like int ) and specify the name of the array followed by square brackets []. To insert values to it, use a comma-separated list, inside curly braces: int myNumbers[] = {25, 50, 75, 100};

What is an array and its types in C?

Array in C are of two types; Single dimensional arrays and Multidimensional arrays. Single Dimensional Arrays: Single dimensional array or 1-D array is the simplest form of arrays that can be found in C. This type of array consists of elements of similar types and these elements can be accessed through their indices.

What is an array explain the declaration and initialization of one dimensional array with example?

Ans: Array:- AnAll the data items of an array are stored in consecutive memory locations in RAM. The elements of an array are of same data type and each item can be accessed using the same name. Declaration of an array:- We know that all the variables are declared before they are used in the program.

What is array explain with example?

An array is a variable that can store multiple values. For example, if you want to store 100 integers, you can create an array for it. int data[100];


2 Answers

That would be a two-dimensional array. You can also specify more dimensions:

Multidimensional Arrays (C# Programming Guide)

like image 180
Justin Niessner Avatar answered Oct 06 '22 03:10

Justin Niessner


Each comma adds an additional dimension to the array [,] = 2 dimensional [,,] = 3 dimensional ...

like image 36
BStateham Avatar answered Oct 06 '22 01:10

BStateham