0

I use stackoverflow for the first time.

Error Question 1. I changed n or 4, 16 etc.. result = compile error

Error Question 2. It is not possible to call '2 Dimensional Array' with 'User Defined Function'.

Sorry for the incorrect grammar.

void outputarr(int n, int (*arr)[**n**]){        //n error
    ...
}

void inputarr(int n, int (*arr)[**n**]){         //n error
    ...

}

int main(void){
    int input;
    int *input2;

    cin >> input;

    cout << "Length of Array : " << input << '\n';

    input2 = &input;

    int **arr = new int*[input]; 
    for(int i=0; i<input; i++)  
        arr[i]= new int[input];


    **inputarr(input, arr);      // pass to input&output error
    outputarr(input, arr);**     // pass to input&output error



    for(int i=0; i<input; i++)  
        delete[] arr[i];
        delete[] arr;   

    return 0;
}
  • *It is not possible to call '2 Dimensional Array* -- There are no two dimensional arrays in your program. A pointer-to-pointer is not a 2 dimensional array. If you declare an `int**`, you must pass an `int**` to the function, and the function must take an `int**`, or reference to it. – PaulMcKenzie Jun 19 '20 at 05:25
  • There are no two dimensional arrays in your program. A pointer-to-pointer is not a 2 dimensional array. thank you!! – 이강욱 Jun 19 '20 at 05:34
  • You probably mean something like detailed in here: https://stackoverflow.com/questions/5724171/passing-an-array-by-reference But this only works for static arrays, you can't use this syntax when you just use pointers. Use `std::array` or `std::vector` instead. – Lukas-T Jun 19 '20 at 05:54
  • Also is `void outputarr(int n, int (*arr)[**n**])` supposed to be markup for bold text? because it's no C++ syntax and markup doesn't work in code. – Lukas-T Jun 19 '20 at 05:57
  • Thank you Reply churill yes. Expressed in bold. It is not coding. **n** // blod text meas **inputarr(input, arr); outputarr(input, arr);** // blod text meas – 이강욱 Jun 22 '20 at 06:41

0 Answers0