C subscripted value is neither array nor pointer nor vector when assigning an array element value

后端 未结 6 779
悲&欢浪女
悲&欢浪女 2020-12-09 09:36

Sorry for asking the already answered question, I am a newbie to C and don\'t understand the solutions. Here is my function

int rotateArr(int *arr) {
    int         


        
6条回答
  •  悲&欢浪女
    2020-12-09 10:30

    You are not passing your 2D array correctly. This should work for you

    int rotateArr(int *arr[])
    

    or

    int rotateArr(int **arr) 
    

    or

    int rotateArr(int arr[][N]) 
    

    Rather than returning the array pass the target array as argument. See John Bode's answer.

提交回复
热议问题