Comma Operator with indexing 2D arrays

夙愿已清 提交于 2019-11-29 18:23:48

You have to review how to access elements of 2D array. Also, take look at what comma operator does. You have to use [] twice:

adjacencyMatrix[0][i]

The following:

adjacencyMatrix[0, i]

is equivalent to:

adjacencyMatrix[i]

Which will still leave you with 1D array. And, as the error message says:

   distanceArray[i] = adjacencyMatrix[i];
// ^^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^^^^^^
//   unsigned int   array of unsigned ints

You can not possibly expect this assignment to happen.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!