How to pass 2D array (matrix) in a function in C?

前端 未结 5 634
旧时难觅i
旧时难觅i 2020-11-22 01:31

I need to do this to persist operations on the matrix as well. Does that mean that it needs to be passed by reference?

Will this suffice?

void operate

5条回答
  •  无人共我
    2020-11-22 02:05

    2D array:

    int sum(int array[][COLS], int rows)
    {
    
    }
    

    3D array:

    int sum(int array[][B][C], int A)
    {
    
    }
    

    4D array:

    int sum(int array[][B][C][D], int A)
    {
    
    }
    

    and nD array:

    int sum(int ar[][B][C][D][E][F].....[N], int A)
    {
    
    }
    

提交回复
热议问题