Search:

Type: Posts; User: Hodor

Page 1 of 20 1 2 3 4

Search: Search took 0.05 seconds.

  1. 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,...
  2. 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...
  3. You're compiling with gcc? $ pwd...

    You're compiling with gcc?



    $ pwd
    /home/HODOR/tmp/abhi

    $ ls
    main.c other.c other.h
  4. 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;
  5. 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...
  6. Ok, I'll agree. Let's just call it a terrible...

    Ok, I'll agree. Let's just call it a terrible bubble sort.
  7. 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*
  8. Replies
    10
    Views
    134

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

    Yeah, this is probably better. I for some reason didn't notice this was c++ :)
  9. 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...
  10. Replies
    10
    Views
    134

    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...
  11. 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...
  12. Thread: FPN math

    by Hodor
    Replies
    77
    Views
    1,385

    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)
  13. 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...
  14. 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...
  15. 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;
  16. 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.
  17. 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...
  18. Replies
    6
    Views
    93

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

    Sounds like an annoying swishing noise to me. Hurts my arm after a while as well
  19. 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...
  20. It's a different program :/

    It's a different program :/
  21. 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;
    ...
  22. Replies
    5
    Views
    100

    No, that's wrong. You're passing the address...

    No, that's wrong. You're passing the address because you want to modify the value of 'a' and for that modified value be reflected in the calling function (in this case, main()).

    I just noticed...
  23. Replies
    5
    Views
    100

    ok, in main() 'a' is an integer, not a pointer to...

    ok, in main() 'a' is an integer, not a pointer to an integer so change these lines (line 8 and 13)



    printf("address of a is : %p \n", a); /* line 8 */
    printf("after calling address of a is :...
  24. Replies
    5
    Views
    100

    The address has not been changed. In this code: ...

    The address has not been changed. In this code:



    printf("address of a is : %p \n", a);
    // ...



    printf("after calling address of a is : %p\n", a);
  25. Replies
    4
    Views
    139

    In your example 'TimerFlag' is set/changed in the...

    In your example 'TimerFlag' is set/changed in the function ISR(). By using volatile you've told the compiler that, yeah it might change not matter what you think. Without your compiler might get rid...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4