Search:

Type: Posts; User: john.c

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. The program is badly structured. Your "readline"...

    The program is badly structured.
    Your "readline" routine should just, you know, read a line.
    Then you can pass it to another function to do whatever it is you are trying to do (which I can't quite...
  2. buffer[i] makes no sense here. In fact, i itself...

    buffer[i] makes no sense here.
    In fact, i itself makes no sense.
    What are you trying to do here?

    And, technically, invalid_characters should be const. (And spelled consistently!)
  3. Replies
    1
    Views
    84

    IMO, it would be pretty pointless to constantly...

    IMO, it would be pretty pointless to constantly check for NULL pointers and return some kind of code to the caller in every function that receives a pointer. The caller can ensure his inputs are not...
  4. Replies
    2
    Views
    93

    The compiler acts as if it redefines the variable...

    The compiler acts as if it redefines the variable every loop iteration, but it doesn't necessarily do it that way. At a high enough optimization level, it will probably notice that the entire loop...
  5. Replies
    10
    Views
    149

    I'm wondering if he was supposed to use the...

    I'm wondering if he was supposed to use the "boardGame" class in making the new class. I don't think inheritance would be correct, but maybe something like:


    class tdBoard {
    boardGame bg[3];...
  6. Replies
    6
    Views
    106

    Yes, they are all the same. The point is that you...

    Yes, they are all the same. The point is that you can pass the exact same array to all of them. The last version is just explicitly saying what is actually happening. The other two are in a sense...
  7. Replies
    6
    Views
    106

    Do you understand that these all say essentially...

    Do you understand that these all say essentially the same thing?


    void f(char matrix3d [10][20][30]);
    void g(char matrix3d [ ][20][30]);
    void h(char (*matrix3d) [20][30]);

    When you...
  8. Replies
    6
    Views
    99

    head is a pointer variable that initially holds...

    head is a pointer variable that initially holds the address of the current first node, which will be NULL (basically zero) if the list is empty.

    The newly created node's next pointer is set to...
  9. Replies
    5
    Views
    157

    I think this is what you are trying to do. ...

    I think this is what you are trying to do.


    #include <stdio.h>
    #include <stdlib.h>
    #include <stdbool.h>
    #include <string.h>

    #define EXTEND_SIZE 256
  10. Replies
    5
    Views
    157

    If you're still having problems, post a complete...

    If you're still having problems, post a complete program that I can run.
    Also post the input.
  11. Replies
    10
    Views
    149

    This code is pretty senseless, actually. Why is...

    This code is pretty senseless, actually.
    Why is tdBoard derived from boardGame?
    It's not using any of it's functionality or data at all!
    You could delete 150+ lines and the program would be...
  12. Replies
    18
    Views
    287

    Oh, you're right. Except that the way we would...

    Oh, you're right. Except that the way we would usually handle it is by adding an extra space (just a space, not a newline) in front of the format of your other scanf.


    int len = 0;
    ...
  13. Replies
    18
    Views
    287

    You shouldn't have the newline character in that...

    You shouldn't have the newline character in that scanf format. It should just be:


    scanf("%d", &len);
  14. Replies
    2
    Views
    82

    I'm not sure what you're getting at. Both of...

    I'm not sure what you're getting at. Both of those seems to "work".

    However, if you mean to only allow decimal input for the integer then it's better to use %d instead of %i since %i accepts...
  15. Replies
    14
    Views
    300

    Thanks man. You didn't do anything wrong at all....

    Thanks man. You didn't do anything wrong at all. (I really was cranky, complete with headache!)
  16. Replies
    14
    Views
    300

    The basic meaning of + is not an overload and...

    The basic meaning of + is not an overload and they are definitely intrinsic to the compiler. They are pretty much just single assembly code instructions since the basic types correspond generally to...
  17. Replies
    2
    Views
    82

    This works for me (in C++14 so that the binary...

    This works for me (in C++14 so that the binary literals are legal) :


    #include <iostream>
    #include <bitset>


    using State = std::bitset<4>;

    struct Person {
  18. Replies
    4
    Views
    115

    @Zeus, perhaps if you don't know anything about a...

    @Zeus, perhaps if you don't know anything about a topic you can just shut the f up? He can use google himself.

    At any rate, in C "generic data structure" can mean a couple of different things. It...
  19. Replies
    9
    Views
    155

    It is a case of underflow. With unsigned values...

    It is a case of underflow. With unsigned values underflow and overflow are well-defined. With signed values they aren't. Underflow is like turning an odometer backwards from 0, except in binary. So...
  20. Replies
    2
    Views
    71

    It looks like you are missing this: ...

    It looks like you are missing this:


    prevDate->next_date->next_date = NULL;


    BTW, don't do this:


    if (prevDate->next_date == NULL) {
  21. Replies
    12
    Views
    160

    @laserlight, I checked it and it compiles just...

    @laserlight, I checked it and it compiles just fine.
    And moving the inline keyword to the original position causes an error.
  22. Replies
    1
    Views
    294

    When you look at the errors that the compiler...

    When you look at the errors that the compiler spits out, always scroll back to the very first one and deal with that one first. The first error your compiler should mention is that in the function...
  23. Replies
    12
    Views
    160

    I used my googlefu and typed in "programming...

    I used my googlefu and typed in "programming library measurement error".


    That's definitely a laserlight question (she's a C++ expert). However, what you have looks pretty good to me, with the +=...
  24. Replies
    12
    Views
    160

    Perchance List of uncertainty propagation...

    Perchance List of uncertainty propagation software - Wikipedia
  25. Replies
    4
    Views
    109

    You dereference the pointer before you check if...

    You dereference the pointer before you check if it's null.

    BTW, don't put "void" in the parameters when a function takes nothing. Just leave the parentheses empty. In old C you had to do that,...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4