I would like to debug 2D array that is dynamicly allocated with malloc. All i want to know is if I can check with debugger what the array contains. I have made an simple program:
#include <stdio.h>
#include <stdlib.h>
int main(void){
int height = 5, width = 5;
//creating array
int **arr = (int **)malloc(height * sizeof(int *));
for (int i=0; i<height; i++)
arr[i] = (int *)malloc(width * sizeof(int));
//filling array
int counter = 0 ;
for (int i = 0 ; i < height ; i++){
for (int j = 0 ; j < width ; j++){
arr[i][j] = counter;
counter ++;
}
}
//breakpoint
//printing array to console
for (int i = 0 ; i < height ; i++) {
for (int j = 0; j < width; j++) {
printf(" %d |", arr[i][j]);
}
printf("\n");
}
return 0;
}
When I want to breakpoint after filling the array with data I cant see the int values. All i can check is this : https://i.stack.imgur.com/2ZD1N.jpg