I have this code written in C:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void print_array(char** array, int height, int width);
int main()
{
    int height, width;
    char **array = 0;
    printf("Give height board size:");
    scanf("%d", &height);
    printf("Give width board size:");
    scanf("%d", &width);
    print_array(array, height, width);
    return 0;
}
void print_array(char** array, int height, int width)
{
    int i, j;
    printf("\n |"); for (j = 0; j < width; j++) printf("-");
    printf("|\n");
    for (i = 0; i < height; i++)
    {
        printf(" |");
        for (j = 0; j < width; j++) printf("%c", array[i][j]);
        printf("|\n");
    }
    printf(" |"); for (j = 0; j < width; j++) printf("-");
    printf("|");
}
The expected result was this for 10x10
|----------|
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|          |
|----------|
But the actual result for whatever number I give to Height is
E.g. Height 10 and Width 20
|--------------------|
|
If I run with Visual Studio I actually get and error code on line 32 which is the following
Exception thrown: read access violation. array was 0x1110112.
Line 32
for (j = 0; j < width; j++) printf("%c", array[i][j]);
 
     
    