Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED]Qt Creator 2D Array not saving values at right spot

[SOLVED]Qt Creator 2D Array not saving values at right spot

Scheduled Pinned Locked Moved Qt Creator and other tools
2 Posts 1 Posters 700 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    newbie08
    wrote on last edited by
    #1

    Hello Forum :)

    I have a little problem with Qt Creator, now I hope I'm simply over seeing something.
    I am writing to a 2D array with a for loop to [i,0], so all first spots get filled with 0-size.
    now in NetBeans this is no problem at all, but for some reason in Qt Creator, it always saves one spot further, I even tried using a const int zero = 0, but no budge. it saves the 1 at [1,1] the 2 at [2,2] and so on.. I have these two pictures with the coding plus the debugger showing the array.

    !http://i57.tinypic.com/281061.png(QtCreator)!
    !http://i58.tinypic.com/2ue7e6g.png(NetBeans)!

    Code:
    @Matrix[0][0] = 0;
    const int zero = 0;
    for(i = 1; i < lengthA + 1; i++)
    Matrix[i][zero] = i;
    for(j = 1; j < lengthB + 1; j++)
    Matrix[zero][j] = j;@

    the funny/confusing part is, that the 2nd for loop works and saves it in the right place :?

    Thanks for any help in advance :)

    newbie08

    1 Reply Last reply
    0
    • N Offline
      N Offline
      newbie08
      wrote on last edited by
      #2

      omg, I am so stupid lol

      I see where the problem was, sorry to anyone that took the time to read this :(

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved