Home > Net >  Why write shuchu (float a [] [4]), the 4
Why write shuchu (float a [] [4]), the 4

Time:09-27

Why write shuchu (float a [] [4]), the 4

CodePudding user response:

The book write wrong,
Oneself do a test,

CodePudding user response:

can

Sorry, I am not seriously enough, did not see topic ,
Don't you can write in c #,

CodePudding user response:

Two dimensional array of C/C + + are flat on the memory, such as (space is for the sake of easy to read) :

Int b [3] [4]={1, 2, 3, 4, 5,6,7,8, 9, 2};
Is a three lines, four columns of the array, according to the dimension, b [1] [1]==6;

Int c [6] [2]={1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2};
Is a six lines, two columns of the array, according to the dimension, c [1] [1]==4;

If pass an a [] [] but have not specified enough dimension information,
C/C + + don't know how to fractal dimension, such as a [1] [1] this is 6, 4,

N array, therefore, to spread to at least the length of the (N - 1) d information,


CodePudding user response:

Multi-dimensional array must indicate the n - 1 d dimensions, so as to determine the memory data structure, the final dimension can not indicate, as long as you promise not to cross
  •  Tags:  
  • C#
  • Related