Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    6
    Views
    281

    I forgot to reset the variable arguments for the...

    I forgot to reset the variable arguments for the vfprintf call. It should be:


    void print(const char *fmt, ...) {
    va_list va;
    va_start(va, fmt);

    vprintf(fmt, va);
    ...
  2. Replies
    6
    Views
    281

    _exit() doesn't flush open file buffers. exit()...

    _exit() doesn't flush open file buffers. exit() does.
    You may wish to flush after every line.
    Instead of writing all output twice you could use a function like this:


    void print(const char...
  3. In the 4238-line file, make sure that there is...

    In the 4238-line file, make sure that there is not an extra space before or after the word senator.
  4. I notice that you forgot to initialize k to 0...

    I notice that you forgot to initialize k to 0 before filling your jobs array (which would be better named "jobs" instead of the meaningless "arr"). You are also not testing for end-of-file correctly....
  5. I don't use Windows but maybe you need to...

    I don't use Windows but maybe you need to GlobalFree(hData) before the function returns. And you don't need the double pointer.
    Untested:


    #include <windows.h>
    #include <stdio.h>
    #include...
  6. Replies
    4
    Views
    441

    Think again.

    Think again.
  7. Replies
    1
    Views
    323

    You aren't calling the function, just...

    You aren't calling the function, just "mentioning" the function name, which does nothing.


    #include <stdio.h>

    void foo()
    {
    printf("X\n");
    }
  8. Replies
    4
    Views
    441

    I don't know the problem, but I think it's better...

    I don't know the problem, but I think it's better written like this:


    #include <avr/io.h>
    #include <util/delay.h>

    int main()
    {
    while (1)
    {
  9. Replies
    1
    Views
    248

    wordCountChoice should be an integer, not a char*...

    wordCountChoice should be an integer, not a char* if that's what it is.
    You can convert the string input to an integer with atoi().
    Also note that line 2 above does nothing.
  10. Replies
    9
    Views
    683

    I looked at the generated assembly (with -S) and...

    I looked at the generated assembly (with -S) and it has unrolled the loop, but only for 3 iterations. However, just using -funroll-loops doesn't cause the problem.
  11. Replies
    9
    Views
    683

    -Og enables optimizations that do not interfere...

    -Og enables optimizations that do not interfere with debugging.
    It would not include unrolling loops, which is at least part of what's happening here, albeit incorrectly.
  12. Replies
    9
    Views
    683

    Very strange. You can even start c at 1000....

    Very strange. You can even start c at 1000. Interesting how changing unsigned to int fixes it.


    #include <stdio.h>

    int main()
    {
    unsigned a, b, c = 1000;

    for (a = 0; a < 5; ++a)
  13. The point is that you didn't mention the other...

    The point is that you didn't mention the other post in your question. Someone might have wasted their time helping you when you had already received an answer at the other site.

    BTW, it seems that...
  14. Replies
    17
    Views
    1,398

    That's idiotic. You should crank it up at least...

    That's idiotic. You should crank it up at least as high as -Wall -Wextra -Wpedantic. In fact you can add more, such as -Wshadow to detect shadowing a variable, a common beginner mistake (although...
  15. Don't try to debug the windows header files!...

    Don't try to debug the windows header files!
    Presumably you forgot to include <windows.h> or something.
    If GUID is defined, then the definitions you are missing are:


    typedef GUID IID;
    typedef...
  16. Thread: Unions...

    by john.c
    Replies
    8
    Views
    1,004

    If that's true then why did you show something...

    If that's true then why did you show something different?
  17. Replies
    37
    Views
    2,450

    I doubt that very much. You are clearly a...

    I doubt that very much. You are clearly a braindead moron. :cool:
  18. x is supposed to be an integer, and presumably...

    x is supposed to be an integer, and presumably positive even though it doesn't specify.
  19. What are you babbling about? Don't tell people...

    What are you babbling about? Don't tell people what they can and can't do. You're just a guest here.

    (BTW, the "Reply With Quote" button worked this time, but it sometimes doesn't.)
  20. It seems well-defined to me, although (x - (x -...

    It seems well-defined to me, although (x - (x - 1)) is a strange way to write 1. And the answer for x=5 is not 13.333334 but 13.3333333... (so no possibility of rounding up to a 4, really).

    This...
  21. Replies
    11
    Views
    914

    This sounds totally idiotic. You really don't...

    This sounds totally idiotic.
    You really don't seem to know what you're talking about (and I know assembly quite well).
    Forget I said anything.
  22. Replies
    11
    Views
    914

    Maybe you meant something more like this. ...

    Maybe you meant something more like this.


    #include <ctype.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <time.h>

    int main() {
  23. Replies
    3
    Views
    784

    It can't be written as nested loops without...

    It can't be written as nested loops without totally changing what it does.
    It is by nature a single-dimensional loop.
    Why do you think you want a double loop?
  24. Replies
    9
    Views
    978

    WTF? I didn't realize you had a learning...

    WTF?
    I didn't realize you had a learning disability.
  25. Replies
    9
    Views
    978

    Nope. A "global" is a variable that is accessible...

    Nope. A "global" is a variable that is accessible throughout the program, in all translation units. Although a global never gets "destroyed" until the program ends (when else would it possibly be...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4