Search:

Type: Posts; User: play_fetch

Page 1 of 3 1 2 3

Search: Search took 0.00 seconds.

  1. OK I will print out some stuff later but I...

    OK I will print out some stuff later but I noticed I'm doing g[c][r] or similar but those values are fixed so it is checking fixed values... needs to be x y I think. I'll get back to you on the...
  2. Yeah I saw the error in the loop eventually....

    Yeah I saw the error in the loop eventually. FIxed the other thing just now.. still segfaulting :(



    #include <stdlib.h>
    #include <stdio.h>
    #include "rotate.h"

    /* Rorate the arena by 90...
  3. OK thanks I did that and now I don't get implicit...

    OK thanks I did that and now I don't get implicit things...

    but we're seg faulting on line 20
    according to gdb is this line:
    20 newarena[*pwidth - 1 - y][x] =...
  4. Well I'm going to be doing similar things for...

    Well I'm going to be doing similar things for evolve I imagine, so a separate function is good to have around.. I may need to move it to another c file. They said it was OK to create another .c file,...
  5. So you're saying I need to loop through each x

    So you're saying I need to loop through each x < *pwidth for arena[x] and free it? In the main code and then free(arena)?

    I'm sorry I don't catch on so quick but I get confused easily with all...
  6. The freeing arena is the old arena passed to the...

    The freeing arena is the old arena passed to the rotate method so surely that is okay as it isn't needed any more? I can't free anything (relating to newarena) until I return it anyway can I?
  7. Oh okay well I didn't try to do it because I...

    Oh okay well I didn't try to do it because I couldn't get my head around how to deal with the break bit etc.

    Is this OK in theory?




    code removed..
  8. Is there a way we could do this in one function...

    Is there a way we could do this in one function as I'm not sure we can make our own functions... I can see how todo the first bit maybe


    char** newarena = NULL;
    int i = 0;
    newarena =...
  9. yes, I tell me about it...lol you can see why I'm...

    yes, I tell me about it...lol you can see why I'm getting so confused with it all

    Is this what you mean by this:



    for(y = 0; y < *pheight; y++)
    {
    for(x =0; x < *pwidth; x++)
    {
  10. Fine : And I've been posting the code which...

    Fine :


    And I've been posting the code which has a description of what the functions should do on this forum since the beginning which all clearly state:


    Sorry, but I don't think it will be...
  11. Yeah.. so... it is a bit more complicated...

    Yeah.. so... it is a bit more complicated unfortunately. A lot of people are doing [x][y] = [y][x] and I have been getting a lot of requests for help but unfortunately I am unable to do it myself...
  12. I really don't think so, don't think that I...

    I really don't think so, don't think that I didn't take your advice. If you are referring to the whole
    for each old row
    for each old col
    new[ /* normally rows / col ][ / normally col...
  13. I still need to be checking for NULL columns. I...

    I still need to be checking for NULL columns. I need to set columns with nothing in any of the rows to point to null... or my code won't work. So yes it is giving me a problem.. I will post the rest...
  14. Still no... doesn't work. Think that might be...

    Still no... doesn't work. Think that might be more for rotating 180.. but anyway it doesn't matter because it still seg faults :(


    int x, y;
    char** newarena;

    newarena = (char**)...
  15. If I do, according to what I understand by your...

    If I do, according to what I understand by your suggestion..


    #include <stdlib.h>
    #include <stdio.h>

    #include "rotate.h"

    /* Rorate the arena by 90 degrees clockwise. The pwidth and pheight...
  16. #include #include ...

    #include <stdlib.h>
    #include <stdio.h>

    #include "rotate.h"

    /* Rorate the arena by 90 degrees clockwise. The pwidth and pheight
    * parameters should be pointers to the width and height of the...
  17. Hmms rotate may not work..

    Hmms rotate may not work..
  18. Code works now, had some freeing of memory whilst...

    Code works now, had some freeing of memory whilst still using it going on so that mucked up things.
  19. checking if row is not empty, if it isnt then...

    checking if row is not empty, if it isnt then copy the contents else set the column to null (because columns become rows in the newarena anyway..) so think the trying to get something that points to...
  20. I'm really sorry guys.. I've tried to understand...

    I'm really sorry guys.. I've tried to understand sorry if I get it wrong..





    char **rotate(char **arena, int *pwidth, int *pheight)
    {
    int x, y;
    char **newarena;
  21. I think I was trying to do something similar to...

    I think I was trying to do something similar to the new line I've got replacing it. Problem is though,

    I think that there is an error with the allocating of the new height and width as they should...
  22. You have to admit though, that is slightly...

    You have to admit though, that is slightly confusing.


    OK if I understand correctly then I've got

    #include <stdlib.h>
    #include "rotate.h"


    char **rotate(char **arena, int *pwidth, int...
  23. OK So now I don't get gdb telling me that the...

    OK
    So now I don't get gdb telling me that the fault is with that line if I do the below.. but now it is on the line newarena [x][y] = ...

    * parameters should be pointers to the width and height...
  24. I'm getting segmentation faults on the lines...

    I'm getting segmentation faults

    on the lines indicated in comments



    char **rotate(char **arena, int *pwidth, int *pheight)
    {
    int x, y;
    char ** newarena;
  25. It doesn't have a rotate in it no so.. I guess it...

    It doesn't have a rotate in it no so.. I guess it is just to spice it up lol.


    Good idea though, thanks I'll have a play with that code..

    Ok I tried and failed miserably at creating a test...
Results 1 to 25 of 57
Page 1 of 3 1 2 3