Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.17 seconds.

  1. You're right. Unfortunately, what this means is...

    You're right. Unfortunately, what this means is that the project that you've found has a missing file. You'll have to file a bug report or otherwise contact the maintainer to have it fixed.

    EDIT:...
  2. That looks impossible: you commented out the...

    That looks impossible: you commented out the include of errors.h, so how could the compiler still be complaining about its content? It should be complaining about code that depends on what was...
  3. You probably have to #include in...

    You probably have to #include <windows.h> in errors.h
  4. Replies
    18
    Views
    130

    Is this a C project in that you're supposed to...

    Is this a C project in that you're supposed to write a C program to find g(10^15), or is this more of a computer science project such that you could write a C program if you wanted, but could use...
  5. I suggest defining two structures like this: ...

    I suggest defining two structures like this:

    struct sentence
    {
    double number;
    char *text;
    };

    struct sentence_list
    {
  6. What do I mean concerning what? That's head...

    What do I mean concerning what?


    That's head and tail by different names, so refer to my post #2.
  7. Replies
    7
    Views
    156

    That probably makes it a bad idea: C++...

    That probably makes it a bad idea: C++ programmers are likely primed to expect operator[] to have random (constant time) access for an index and at least logarithmic time access otherwise (e.g.,...
  8. Replies
    34
    Views
    294

    Oh, I missed this: It isn't because the inner...

    Oh, I missed this:

    It isn't because the inner loop always loops in successively smaller iterations, whereas you can terminate the inner loop at the point of the last swap in the previous...
  9. Use another static local variable to record the...

    Use another static local variable to record the previous value of x. If x differs from this static local, then you know that it is time to reset exponent.
  10. Replies
    34
    Views
    294

    As in Zeus_'s post #10? That's a bubble sort. It...

    As in Zeus_'s post #10? That's a bubble sort. It is equivalent to the Wikipedia bubble sort article's "Optimizing bubble sort" first example pseudocode, except that instead of just decrementing Size...
  11. Replies
    34
    Views
    294

    This definitely looks like a better candidate for...

    This definitely looks like a better candidate for a bubble sort, and it looks like it was taken directly (with expansion of the swap function/macro) from your "Bubble sort misconceptions" link under...
  12. A tale of two sorts: classifying an inefficient sorting algorithm

    This thread has branched off from wufflz's Bubblesorting Array elements in order to avoid going too far off track for that discussion. It makes reference to Owen Astrachan's Bubble Sort: An...
  13. Replies
    34
    Views
    294

    This is not a bubble sort as it does not always...

    This is not a bubble sort as it does not always swap adjacent elements:

    I guess that's why you call it "dodgy bubble sort", but isn't that just misleading?
  14. That's also a linked list that prepends to the...

    That's also a linked list that prepends to the head, which is not what I'm talking about, unless you want to invert it and say to enqueue to prepend to the head, and to dequeue is to retrieve and...
  15. Replies
    34
    Views
    294

    They don't: this one doesn't always swap adjacent...

    They don't: this one doesn't always swap adjacent elements. Perhaps you missed:

    So, if you agree that terminating early is an optimisation for bubble sort, then it follows that terminating early...
  16. You just need a linked list for which you keep...

    You just need a linked list for which you keep track of both the head and the tail. To enqueue is to append a new node at the tail; to dequeue is to retrieve and remove the node at the head.
  17. Replies
    34
    Views
    294

    Eh, I'm really curious who has been going around...

    Eh, I'm really curious who has been going around teaching students to implement a bubble sort that doesn't stop when no more swaps are performed.
  18. Replies
    6
    Views
    110

    Exactly. atoi suffers from the same design flaw,...

    Exactly. atoi suffers from the same design flaw, which is why strtol is usually recommended as an alternative. strtol switches things around a bit to have the output be a return value and the error...
  19. Replies
    6
    Views
    110

    My question would then be: why is this...

    My question would then be: why is this util_get_string_int when it cannot handle negative number input as would be expected for int? Perhaps it should have been util_get_string_unsigned_int, in which...
  20. Replies
    1
    Views
    94

    This cannot be done purely in standard C, so it...

    This cannot be done purely in standard C, so it would be helpful to know what relevant libraries your teacher has taught or recommended that you use for this exercise.
  21. Replies
    3
    Views
    119

    You might want to read these two technical...

    You might want to read these two technical dictionary entries for abstract data type and data structure. What you have in mind is the former, but when expressed in code we get the latter, which does...
  22. Replies
    12
    Views
    117

    It has to destroy the elements too, though in...

    It has to destroy the elements too, though in this case for int it isn't really relevant.


    And avoided the possibility of running into an assert on some implementation, methinks :p

    ...
  23. Replies
    8
    Views
    181

    You can use #define in a header; it is commonly...

    You can use #define in a header; it is commonly used to define named constants.

    Basically, if you have a header "other.h" that consists entirely of this:

    #define PI 3.1415
    And a "main.c" that...
  24. Replies
    8
    Views
    181

    That looks fine. Is this really the code that you...

    That looks fine. Is this really the code that you compiled? Is there anything that you left out or which isn't the same as what you compiled?
  25. That's because I had in mind comparing with...

    That's because I had in mind comparing with strlen: it would be easier to see that way since you can name the variable so the reader knows why it is compared to strlen. But if you're comparing with...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4