Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    Tools
    1
    2
    589
    Loading More Posts
    • 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
      newbie08 last edited by

      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 Reply Quote 0
      • N
        newbie08 last edited by

        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 Reply Quote 0
        • First post
          Last post