very nice, it works but is a bit funky
if i put this code, it exits with -1073741819 (0xC0000005)
Code:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int i, o, ncolumns = 2, nrows = 3;
int** test = (int**)malloc(nrows * sizeof(int*));
for(i = 0; i < 2; i++)
test[i] = (int*)malloc(ncolumns * sizeof(int));
for(o = 0; o<=nrows; o++)
{
for( i=0;i<=ncolumns;i++)
{
test[o][i] = 1;
cout << test[o][i];
}
}
return 0;
}
but if i put this, it just completely errors...
Code:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int i, o, ncolumns = 2, nrows = 3;
int** test = (int**)malloc(nrows * sizeof(int*));
for(i = 0; i < 2; i++)
test[i] = (int*)malloc(ncolumns * sizeof(int));
for(o = 0; o<=nrows-1; o++)
{
for( i=0;i<=ncolumns-1;i++)
{
test[o][i] = 1;
cout << test[o][i];
}
}
return 0;
}
What gives? I don't think it has anything to do with free() i put it on and made no difference