why this part of code:
int rows = 3, cols = 2, temp, j;
double ** dataArray = new double* [rows];
for(int i = 0; i < rows; ++i)
dataArray[i] = new double(cols);
for (int i = 0; i < rows*cols; i++) {
temp =int(i/2);
j = i%2;
dataArray[temp][j] = temp*j;
}
int rows = 3, cols = 2, temp, j;
double ** dataArray = new double* [rows];
for(int i = 0; i < rows; ++i)
dataArray[i] = new double(cols);
for (int i = 0; i < rows*cols; i++) {
temp =int(i/2);
j = i%2;
dataArray[temp][j] = temp*j;
}
To copy to clipboard, switch view to plain text mode
gives me the following error in Qt???
&"warning: GDB: Failed to set controlling terminal: Invalid argument\n"
*** glibc detected *** /home/tgf/qtExamples/cpp/main6-build-desktop/main6: malloc(): memory corruption: 0x0818f070 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0xfe7591]
/lib/tls/i686/cmov/libc.so.6(+0x6e395)[0xfea395]
/lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x5c)[0xfebf9c]
/usr/lib/libstdc++.so.6(_Znwj+0x27)[0xefec07]
/usr/lib/libQtGui.so.4(+0x6ccc8d)[0x7fac8d
........ (lots of error lines like the above)
I tried this part of code in Geany and it worked normally.
Bookmarks