Search:

Type: Posts; User: auxfire

Search: Search took 0.01 seconds.

  1. Thread: Generic Sort

    by auxfire
    Replies
    13
    Views
    1,454

    If my sorting routine is correct. Why is it not...

    If my sorting routine is correct. Why is it not rearranging the elements correctly?
  2. Thread: Generic Sort

    by auxfire
    Replies
    13
    Views
    1,454

    Ah. I was thinking for tmp_address I would just...

    Ah. I was thinking for tmp_address I would just need a size of a pointer and not the size of the element being copied. The values I enter still aren't being sorted right and I can't find a pattern to...
  3. Thread: Generic Sort

    by auxfire
    Replies
    13
    Views
    1,454

    This code seems to switch the last two of the...

    This code seems to switch the last two of the array..


    for (int i = 1; i < (int)num; ++i) {
    int j = i;
    void *element = (char *)arg + j * size;
    void *tmp_address = malloc...
  4. Thread: Generic Sort

    by auxfire
    Replies
    13
    Views
    1,454

    Thank you for pointing that out! It's early...

    Thank you for pointing that out! It's early morning here.. I completely forgot about the other item..
  5. Thread: Generic Sort

    by auxfire
    Replies
    13
    Views
    1,454

    Generic Sort

    I'm passing an array into this function and it's taking the item at index 0 and replacing the rest of the array with it. Any idea where this is going wrong?


    void generic_sort (void *arg, size_t...
  6. I was doing some test. Buffer in memset is...

    I was doing some test. Buffer in memset is suppose to be numbers. And thanks grumpy I realized it's an array of 1000 doubles. I was used to creating char pointers and never really created an array...
  7. Reading from stdin and printing (Segmentation Fault)

    I'm writing a program that reads from stdin and prints it back out. I'm getting a bunch of garbage then a seg fault.


    double numbers[256];
    memset (numbers, 0, sizeof (numbers));
    for...
  8. Replies
    9
    Views
    1,087

    Thanks! I figured it out.

    Thanks! I figured it out.
  9. Replies
    9
    Views
    1,087

    In my main function I have: while (!...

    In my main function I have:


    while (! isempty_queue (this_queue)) {
    printf("%s\n", remove_from_queue(this_queue));
    }
    free_queue (this_queue);


    Should I be freeing each individual return...
  10. Replies
    9
    Views
    1,087

    linepos is supposed to be lines. I was moving its...

    linepos is supposed to be lines. I was moving its scope and forgot to rename that one. I free each node in remove_from_queue, do I need to free each node's item then the node itself?
  11. Replies
    9
    Views
    1,087

    Help with memory leak

    Here's the leak:


    HEAP SUMMARY:
    in use at exit: 302 bytes in 14 blocks
    total heap usage: 30 allocs, 16 frees, 1,230 bytes allocated

    302 bytes in 14 blocks are definitely lost in...
Results 1 to 11 of 11