Thread: 2d Array pointers

  1. #1
    Registered User
    Join Date
    May 2016
    Posts
    1

    Angry 2d Array pointers

    I'm trying to create a matrix of pointers to a Line.. but when ever i try to access a member inside the matrix, I get a seg fault? Anyone see the problem?

    2d Array pointers-cache-png

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    You know what's better that a screenshot of the source code? Take a wild guess...

    Anyway, the problem seems to be that you do the opposite of what you want in the final loop. You need to delete that first line:
    Code:
    temp = matrix[i][j];
    and add this line at the end of the inner for:
    Code:
    matrix[i][j] = temp;
    Last edited by GReaper; 05-02-2016 at 11:42 PM.
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 43
    Last Post: 05-23-2013, 03:01 PM
  2. Replies: 7
    Last Post: 05-19-2010, 02:12 AM
  3. Replies: 4
    Last Post: 07-01-2009, 01:53 PM
  4. Replies: 2
    Last Post: 04-27-2008, 03:39 AM
  5. Replies: 1
    Last Post: 10-21-2007, 07:44 AM