Search:

Type: Posts; User: Hodor

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Yeah, I might have got things backwards (I...

    Yeah, I might have got things backwards (I adjusted my first reply appropriately)

    Edit: Also I might be missing something completely because I don't understand why a pointer to pointer is being...
  2. I dunno. To me, I'd be looking for the invalid...

    I dunno. To me, I'd be looking for the invalid character in the buffer, not in the invalid_character string. Dunno why :) It's just how I was reading it based on your description. I'd also do what...
  3. In addition to what @laserlight said, I think you...

    In addition to what @laserlight said, I think you have the order of your parameters incorrect for strcspn(); i.e. invalid_characters should be second, not first

    Edit: Err nevermind (ignore the...
  4. Thread: Hangman game

    by Hodor
    Replies
    5
    Views
    127

    That first printf is not valid. It should be ...

    That first printf is not valid. It should be


    printf("Well done, %s. You have now %d attemps", name, max_attemps);


    Line 94 has the same problem as the above...

    Also lines 25 and 41 are...
  5. Great :) The -o is just to give the output...

    Great :)

    The -o is just to give the output file a name (other than a.out) so maybe that's a mingw requirement (it's not necessary on Linux). I'd definitely add -Wall to your command line, though,...
  6. Also, based on your path names you're using...

    Also, based on your path names you're using Windows. I know mingw and forks, and cygwin are popular but if you just need to compiler programs and not necessarily create Windows .exe files then I find...
  7. You're compiling with gcc? $ pwd...

    You're compiling with gcc?



    $ pwd
    /home/HODOR/tmp/abhi

    $ ls
    main.c other.c other.h
  8. Ok, I think you have other.h and other.c mixed...

    Ok, I think you have other.h and other.c mixed up.

    other.c should contain



    #include "other.h"
    int getnumber(void)
    {
    return 3;
  9. Well... for a start you haven't implemented...

    Well... for a start you haven't implemented getnumber() in other.c (assuming that you have just got the filenames back to front on here but they're right on your computer). You've implemented a...
  10. Ok, I'll agree. Let's just call it a terrible...

    Ok, I'll agree. Let's just call it a terrible bubble sort.
  11. I think maybe it's kind of both now that I look...

    I think maybe it's kind of both now that I look at again. Some kind of weird hybrid :( Personally I think it's more like insertion sort, but *shrug*
  12. Replies
    10
    Views
    145

    Yeah, this is probably better. I for some reason...

    Yeah, this is probably better. I for some reason didn't notice this was c++ :)
  13. What I really meant to say is that things should...

    What I really meant to say is that things should be consistent. I didn't mean that it was wrong to use const (it should be const) I meant that ignoring the const and discarding it the way the...
  14. Replies
    10
    Views
    145

    Maybe pass pointers to the player scores to...

    Maybe pass pointers to the player scores to playgame(). E.g.



    int playgame(int *player1Score, int *player2Score)



    And set increment them appropriately where you're checking for the...
  15. Yeah, that was a typo. Bubble sort terminates...

    Yeah, that was a typo. Bubble sort terminates when no swaps have been made.

    The implementation given by the OP is insertion sort according to Knuth (and the implementation is almost line for line...
  16. Thread: FPN math

    by Hodor
    Replies
    81
    Views
    1,527

    There's also this page: Correct Decimal To...

    There's also this page: Correct Decimal To Floating-Point Using Big Integers - Exploring Binary

    (That entire website has some interesting reading actually)
  17. I've seen insertion sort presented as bubble sort...

    I've seen insertion sort presented as bubble sort in more than one book, but they really are subtly different. All my more technical books (as opposed to introductory books) make the same distinction...
  18. The first error is the most serious (the function...

    The first error is the most serious (the function prototype being wrong) because you need to pass a ** and how they have it it's a *.
    As for the const problem, well it's not really a problem in this...
  19. How is that legal?! It doesn't even compile! ...

    How is that legal?! It doesn't even compile!



    #include <stdio.h>
    #include <assert.h>


    typedef void* Element;
    typedef const void* ConstElement;
  20. Looks like insertion sort to me as well....

    Looks like insertion sort to me as well. According to Knuth (Vol 3) and Wikipedia the defining feature of insertion sort is that the terminating condition is when no swaps have occurred.
  21. There is no hard and fast "rule". But for a...

    There is no hard and fast "rule". But for a circular queue that is implemented using an array then tail would in general be the index of the element, of the array, where something can be stored. It's...
  22. Replies
    6
    Views
    113

    Sounds like an annoying swishing noise to me....

    Sounds like an annoying swishing noise to me. Hurts my arm after a while as well
  23. For your original program, how can tail be 4...

    For your original program, how can tail be 4 (i.e. why are you expecting 4) when the array representing the queue only has 4 elements (indices 0, 1, 2, 3). I'd expect tail to be 0, not 4.

    Changing...
  24. It's a different program :/

    It's a different program :/
  25. Replies
    6
    Views
    152

    Err, that's not exactly true either. A static...

    Err, that's not exactly true either. A static object has a lifetime that extends beyond the lifetime of the function. E.g.



    #include <stdio.h>

    int *fn (void)
    {
    static int foo = 0;
    ...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4