Search:

Type: Posts; User: bot

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. ----

    ----
  2. Thread: Value order

    by bot
    Replies
    18
    Views
    9,803

    The first thing you should do is to have a...

    The first thing you should do is to have a consistent style of indentation. You can read more about indentation in programming here:

    Indenting C Programs
    The Only Correct Indent Style |...
  3. Thread: Value order

    by bot
    Replies
    18
    Views
    9,803

    I wouldn't call myself an experienced programmer...

    I wouldn't call myself an experienced programmer but I would suggest to break down the complex task into a series of simpler problems. For example you could implement the 16 slots or whatever the...
  4. Thread: Value order

    by bot
    Replies
    18
    Views
    9,803

    This stack could be dynamically allocated (with...

    This stack could be dynamically allocated (with malloc()) or be fixed which is viable as you know that there will be no more than 8 players. For a fixed stack, you could let the slots be an 8 levels...
  5. Thread: Value order

    by bot
    Replies
    18
    Views
    9,803

    Yes, I too would rather work with vectors and...

    Yes, I too would rather work with vectors and arrays directly myself. If someone somehow however would want to maintain a clear association between each camel color and field, my suggestion above...
  6. Thread: Value order

    by bot
    Replies
    18
    Views
    9,803

    I think all those if statements in post #6 could...

    I think all those if statements in post #6 could altogether be replaced with the following lines of code:



    const *char[] szykKolorowy = { "niebieska", "zielona", "pomaranczowa",
    ...
  7. Replies
    1
    Views
    1,210

    I find it hard to understand what is your...

    I find it hard to understand what is your question. You have an already half way written program, all that remains is to complete it. The char l doesn't contain all the letters of the aleph-bet and...
  8. But if the program doesn't clean up after itself,...

    But if the program doesn't clean up after itself, won't the allocated memory stay allocated even after the program terminates? I have a (biological) memory that memory that wasn't freed will remain...
  9. Replies
    4
    Views
    1,519

    The time measured comes as reported by the...

    The time measured comes as reported by the website (kattis.com) so I would assume that they use proper tools to measure the time to execute. Perhaps it is an average value of a larger number of runs....
  10. Replies
    4
    Views
    1,519

    How can I improve the performance of this code?

    To begin with, I want to say thank you to all people who have helped me with issues that I had with c programming. That is a learning journey that I'm undertaking. I'm trying to be playful and...
  11. Interesting, so it isn't that the dynamically...

    Interesting, so it isn't that the dynamically allocated memory itself is slower than "statically" allocated memory at the beginning of the program, but the calls to malloc(), calloc() and realloc()...
  12. I really feel like an idiot now, thank you, it...

    I really feel like an idiot now, thank you, it works!

    So changing from

    void pushQueue(element) {
    ...
    }
    to

    void pushQueue(Pixel element) {
  13. compiler error: left of ' ' must have struct/union type

    I've been experimenting with different types of "queues" of fixed size which I have shown in a previous thread. Now however, I want to design a proper queue of unspecified length that allocates and...
  14. Replies
    18
    Views
    6,665

    Of course, I probably went through the code at...

    Of course, I probably went through the code at least 15 times without seeing it! I knew that it should start from 1 so I completely overlooked it. Thank you for that, this is a little embarrassing I...
  15. Replies
    18
    Views
    6,665

    I didn't know this thing with sqeuence points was...

    I didn't know this thing with sqeuence points was such an issue. I have always assumed that when coding say


    int x = 5, y = 6;
    int z = x++ + y++;

    then it means that the compiler should first...
  16. Replies
    18
    Views
    6,665

    If you interpret my response as snarky, then I...

    If you interpret my response as snarky, then I apologize. That was not my intention and your help has been much appreciated. I will look into your suggestions in a bit.

    Yes when queueLength...
  17. Replies
    18
    Views
    6,665

    Sorry but it doesn't compile at all on any...

    Sorry but it doesn't compile at all on any platform with "worldArray[i] = worldArray[i - 1] + NCOLS;", I hope you are aware that this is an array of booleans, not integers. I had a little hope to...
  18. Replies
    18
    Views
    6,665

    I think you should use worldArray[i] =...

    I think you should use

    worldArray[i] = worldArray[i - 1 + NCOLS];instead of

    worldArray[i] = worldArray[i - 1] + NCOLS;
    As I understand, 2-dimensional arrays are stored as a 1-dimensional...
  19. Replies
    18
    Views
    6,665

    Yes, I actually am in the process of optimizing...

    Yes, I actually am in the process of optimizing the code. Something in the program that I was thinking that was using CPU cycles is the requeue() function. I was thinking that shuffling data back and...
  20. Replies
    18
    Views
    6,665

    Yes, yes, that solved my problem and the website...

    Yes, yes, that solved my problem and the website accepted my program. Thank you! Tank you!

    It also runs fine now in the Windows environment.

    I find it rather strange that it doesn't crash...
  21. Replies
    18
    Views
    6,665

    See page 9 of the following document for problem...

    See page 9 of the following document for problem description:

    http://challenge.csc.kth.se/2011/problems.pdf
  22. Replies
    18
    Views
    6,665

    The variables nRows and nCols are the number of...

    The variables nRows and nCols are the number of rows and columns of the map that is fed into the program. I let the program surround the the map with a border of 0's. So the actual matrix has...
  23. Replies
    18
    Views
    6,665

    I'm unable to troubleshoot with the debugger...

    I'm unable to troubleshoot with the debugger because I don't have access to the data that gives rise to the exception. The program is compiled and tested on a website and all you get is whether it...
  24. Replies
    18
    Views
    6,665

    This code gives rise to segmentation fault

    The following program is supposed to solve the coast problem:



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

    bool **worldArray;
    bool **removalMask;
  25. Replies
    8
    Views
    1,640

    Ok, just to make a clearer illustration of the...

    Ok, just to make a clearer illustration of the issue:




    int *array1 = new[iSize1], *array2 = new[iSize2];
    ...
    delete[] array1, array2;
Results 1 to 25 of 72
Page 1 of 3 1 2 3