void inputArray(int* *pa, int *n)
{
do {
printf("Input the elements: ");
scanf_s("%d", n);
if (*n < 0)
{
printf("Error! Input again\n");
}
} while (*n < 0);
*pa = (int*)malloc(*n * sizeof(int));
for (int i = 0; i < *n; i++)
{
printf("Elements a[%d]: ", i);
scanf_s("%d", pa + i);
}
}
void outputArray(int* *pa, int n)
{
printf("\nContent of the array\n");
for (int i = 0; i < n; i++)
{
printf("a[%d] = %d\n", i, *(pa + i));
}
}
int main()
{
int *A;
int n;
inputArray(&A, &n);
outputArray(&A, n);
free(A);
_getch();
return 0;
}
When the program display the array, I got the error "Exception thrown at 0x00AD372D (ucrtbased.dll)" I'd tried many times to fix the error, but it still displays the error when the program displays the output of array, please give me some advice. Thanks for reading.