I'm trying to solve the following problem:
"Write a C program that multiplies an n x n matrix by an n-element vector. Choose n as large as your memory allows."
The matrix multiplication is very easy to implement and you can find enough information on the internet, but I have no idea how to figure out the maximum allocable size of my memory.
The first thing thTat crossed my mind was to do a dynamic memory allocation with the functions malloc() and realloc() and see how much it is possible.
int main() {
int n = 0;
float** first = (float**) malloc(sizeof(float*));
while(1) {
next** = (float**) realloc(first, n * sizeof(float*));
n++;
if (next == NULL) {
break;
}
}
}
The problem is, that Windows 10 is using virtual RAM and stuff, so this method results in an endless loop.
Any Ideas ?