Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.17 seconds; generated 43 minute(s) ago.

  1. Having said that, I realised that you wrote "not...

    Having said that, I realised that you wrote "not all the boxes are mandatory". Does this mean that all the root box names are known in advance? If so, then maybe you're overthinking it: a struct of...
  2. Basically, you want to map root box names to...

    Basically, you want to map root box names to struct objects. As per the hint from Perl's hash variables, one way is to hash these names as strings so that they become indices in some kind of hash...
  3. Replies
    13
    Views
    2,328

    I suggest that you learn to use the standard...

    I suggest that you learn to use the standard library and perhaps other common utility libraries before you go along the path of the obscure. After you learn to use them, learn to implement them.

    I...
  4. Replies
    13
    Views
    2,328

    It sounds like you just want to do something like...

    It sounds like you just want to do something like what strcmp does to produce a yes/no result concerning the question of whether the strings are equal. If so, then it could be as simple as:

    const...
  5. Poll: * looks at votes * The tribe has spoken.

    * looks at votes *

    The tribe has spoken.
  6. Replies
    8
    Views
    1,046

    Your strategy of using char and character...

    Your strategy of using char and character constants in a switch should be absolutely portable for any standard conforming C implementation since the C standard explicitly mandates that those...
  7. The key is to understand why do we return a...

    The key is to understand why do we return a pointer from the ADD function in the first place. The answer to that is that we want to update the head pointer from the caller, and we cannot do that...
  8. Thread: DFS in C

    by laserlight
    Replies
    2
    Views
    1,516

    Perhaps it would be easier if you provided your...

    Perhaps it would be easier if you provided your implementation of the recursive approach too, as well as your test input data that demonstrates the different result.
  9. Replies
    8
    Views
    1,244

    Since you're using MinGW, the issue here might be...

    Since you're using MinGW, the issue here might be that the Visual C runtime is used, or something like that. It is why instead of the standard %lld you may have to use %I64d or something like that to...
  10. Replies
    4
    Views
    585

    The typical approach is to provide an opaque...

    The typical approach is to provide an opaque pointer. But this means that all the functions that make up the interface of your library must either accept a pointer parameter or return a pointer that...
  11. Yes. Yes Yes, but that's a...

    Yes.


    Yes


    Yes, but that's a self-referential tautology and hence doesn't really mean anything useful. What you probably meant to say is that you think that the next pointer of the first node...
  12. The OP wrote it right there in post #1: This...

    The OP wrote it right there in post #1:

    This is typically used when you want to have a constant time append operation for the linked list (in addition to constant time prepend).
  13. Yes. Yes. I think you're talking about...

    Yes.


    Yes.


    I think you're talking about the next pointer of the first node. Since the first node was only just created, there is no second node, hence the next pointer of the first node must...
  14. Replies
    6
    Views
    522

    spvar is a pointer to struct point. Therefore,...

    spvar is a pointer to struct point. Therefore, *spvar is a struct point. So what you're doing here:

    printf( "%d ", *spvar );
    is trying to print a struct point object as if it were an integer. It...
  15. Replies
    6
    Views
    522

    Unfortunately, you cannot assign to an array...

    Unfortunately, you cannot assign to an array itself. However, you can initialise them, and in this case it means initialising the struct of which the array is a member:

    struct point svar = {1, 2,...
  16. Thread: typedef

    by laserlight
    Replies
    7
    Views
    886

    Yeah, I hold that opinion too, as my objection to...

    Yeah, I hold that opinion too, as my objection to object pointer typedefs has to do with pointer notation such as dereferencing the pointer then becoming surprising. For opaque pointers, neither any...
  17. Replies
    10
    Views
    893

    Unfortunately, since new does not necessarily...

    Unfortunately, since new does not necessarily have a size of sizeof(struct point) bytes unless you've checked its declaration to confirm, it isn't as self-documenting as using sizeof(*new), in which...
  18. Replies
    3
    Views
    385

    For #2, I'd guess that you have mixed up the...

    For #2, I'd guess that you have mixed up the address-of operator with the bitwise and operator. They both use the & symbol but with very different syntax and semantics.
  19. Replies
    12
    Views
    894

    Why don't you give it a try? In the code you...

    Why don't you give it a try? In the code you showed, you didn't even have a variable for the count. Put in a bit more effort.
  20. Replies
    12
    Views
    894

    One approach is to keep track of the current...

    One approach is to keep track of the current value with a variable. Another approach is to compare the value of the current element with the value of the previous element.
  21. Replies
    3
    Views
    364

    john.c introduced a struct type in order to...

    john.c introduced a struct type in order to construct a linked list, i.e., struct N represents a linked list node. This way, you can store the values in a linked list and thereby loop over the linked...
  22. You might find it more insightful and more useful...

    You might find it more insightful and more useful for learning, both theoretical and applied, to implement qsort yourself, using a different name but with the same parameter list and return type....
  23. Replies
    10
    Views
    684

    I suggest a function prototype like this: char...

    I suggest a function prototype like this:

    char *reverseString4(const char *str);
    To implement roughly the same thing as the C++ code, you would:

    1. Call strlen to find out the length of str....
  24. Why do your nodes have a member named f that...

    Why do your nodes have a member named f that appears to function as a "free flag"?

    I would expect that the callback function would set this flag (or not) when called, thus indicating that the node...
  25. Yes, you don't know what you're doing with your...

    Yes, you don't know what you're doing with your program. If you disagree, read your code from decades ago and you'll realise that it is true :p
Results 1 to 25 of 499
Page 1 of 20 1 2 3 4