why this part of code:

Qt Code:
  1. int rows = 3, cols = 2, temp, j;
  2. double ** dataArray = new double* [rows];
  3. for(int i = 0; i < rows; ++i)
  4. dataArray[i] = new double(cols);
  5.  
  6. for (int i = 0; i < rows*cols; i++) {
  7. temp =int(i/2);
  8. j = i%2;
  9. dataArray[temp][j] = temp*j;
  10.  
  11. }
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.