while running the code below in C (visual studio 2019), I get Access violation error in the "SetArr" function
the program stops and exits with this message.
any help will be appreciated
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void SetArr(int** arr, int rowNum, int colNum);
void zeros(int** arr, int rowNum, int colNum);
int **arr1, **arr2;
int i, j, input,output;
int main() {
zeros(arr1, 2, 3);
SetArr(arr1, 2, 3);
}
void zeros(int** arr, int rowNum, int colNum) {
arr = (int**)malloc(sizeof(int*) * rowNum);
for (i = 0; i < rowNum; i++) {
arr[i] = (int*)malloc(sizeof(int) * colNum);
}
}
void SetArr(int **arr, int rowNum, int colNum) {
for (i = 0; i < rowNum; i++) {
for (j = 0; j < colNum; j++) {
scanf_s("%d", &input);
arr1[i][j] = input;
}
}`
}