I recently learned how to use fscanf_s, While tinkering with fscanf_s I made a code that reads a file and save it into an array. (The file contains 123 12 41 234 5 12 45 1 5 764 232
)
First I made a piece of code to test if I made my While loop correctly
void arr_calc(FILE*f, ~~) {
int i = 0, ~~;
...
rewind(f);
int arr[10];
while (fscanf_s(f, "%d", &arr[i++]) != EOF);
}
When I checked the debug screen(autos), arr
showed up like this
I could see what the arr
was holding with this, But when I changed the int arr[10]
into malloc
to make a variable sized array like this
void arr_calc(FILE*f, ~~) {
int i = 0, * arr, ~~;
...
rewind(f);
arr = (int*)malloc((count) * sizeof(int));
while (fscanf_s(f, "%d", &arr[i++]) != EOF);
}
I couldn't figure out what arr
was holding. - it only showed the first value
I presume that it has to do with the fact that I'm using a pointer for arr
when I use malloc
.
my question is: Is there a way that I can see the elements inside arr
in the debug autos when using malloc(or realloc)?
If I said something wrong please correct me, Thank you