Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.11 seconds.

  1. Are you basically implementing a semaphore?

    Are you basically implementing a semaphore?
  2. Yes, like this: std::string...

    Yes, like this:

    std::string format_time(std::time_t time_value)
    {
    std::string result(20, '\0');
    std::strftime(&result[0], result.size(), "%d/%m/%Y %T", std::localtime(&time_value));
    ...
  3. There are two problems with your code: The...

    There are two problems with your code:

    The std::string is empty.
    You're calling c_str(), which returns a const char*, and then casting away the constness, which could be problematic if the...
  4. Replies
    14
    Views
    230

    That's what I mean by "Either that, or you reuse...

    That's what I mean by "Either that, or you reuse a suitable member, but that's code obfuscation."

    Basically, instead of properly designing a way to convey the number of items, you're obfuscating...
  5. Replies
    14
    Views
    158

    From what I see, you want to parse that line of...

    From what I see, you want to parse that line of input separated by semi-colons into the nodes of a linked list.

    If you find this difficult to understand, then take a step back and imagine you had...
  6. Replies
    14
    Views
    158

    Post code. Actually, let's make this a rule:...

    Post code. Actually, let's make this a rule: whenever you ask a question that has to do with some code concept, post relevant code to go along with it.
  7. Replies
    14
    Views
    158

    What do you mean by the "self-reference part"? A...

    What do you mean by the "self-reference part"? A code snippet might help.
  8. Replies
    14
    Views
    158

    Are you talking about a node in a linked list? If...

    Are you talking about a node in a linked list? If so, the pointer to a node that is a member of the node struct is not a "self-reference"; it is a pointer to the next node in the linked list.
  9. Replies
    14
    Views
    230

    That's not a good idea: it means that you need a...

    That's not a good idea: it means that you need a member in the struct object just for storing the number of items, and this member is uselessly repeated for all the struct objects even though most of...
  10. Replies
    2
    Views
    102

    For out of bounds checking you would compile...

    For out of bounds checking you would compile without defining NDEBUG and enable options like checked iterators, as well as placing your own pre-condition/post-condition assertions.
  11. Thread: Struct.

    by laserlight
    Replies
    11
    Views
    129

    Your question does not make sense. Perhaps you...

    Your question does not make sense. Perhaps you should write a test program to illustrate the options you're considering.
  12. Replies
    1
    Views
    179

    As you say, this is for fun, so you don't have to...

    As you say, this is for fun, so you don't have to take it so seriously, hence you just need to make it recognisably C. For example:

    struct baby *expecting(void) {
    delay(23587200);
    size_t...
  13. Replies
    2
    Views
    111

    Get rid of this: token = (char*) malloc...

    Get rid of this:

    token = (char*) malloc (sizeof (50));
    You don't need to malloc as token will be pointing to what strtok returns.

    This:

    if ( argc == 2 ) {
    strcpy(myfile, argv[1]);
    }
  14. Replies
    6
    Views
    155

    The term is "member" not "call". Anyway, have...

    The term is "member" not "call".

    Anyway, have you successfully done this with nodes containing one such member?
  15. Replies
    2
    Views
    99

    Put aside this program and instead write a...

    Put aside this program and instead write a program that prints "yes" if the number input is a palindrome number and "no" otherwise. Show us this program.

    The idea is that first you need confidence...
  16. When you start getting worried about "mixing...

    When you start getting worried about "mixing variables", it means that it is time to break your function into smaller functions that each does one thing and does it well.


    Then don't assume....
  17. Are you sure velocidad_media is working correctly...

    Are you sure velocidad_media is working correctly with the input from fgets? Recall that fgets stores the newline from reading the line at the end of the string if there is space for it.
    ...
  18. Replies
    5
    Views
    125

    You declared struct mme_ue_t, so you can only use...

    You declared struct mme_ue_t, so you can only use struct mme_ue_t, not mme_ue_t. You need a typedef to use mme_ue_t.
  19. Replies
    5
    Views
    125

    Why don't you write a tiny example program and...

    Why don't you write a tiny example program and try to compile it?
  20. Replies
    5
    Views
    125

    It is a declaration of a function named...

    It is a declaration of a function named sgsap_build that takes a pointer to mme_ue_t as an argument and returns a pointer to X.

    Note that you should have a typedef of struct mme_ue_t to mme_ue_t.
  21. Replies
    3
    Views
    133

    I'd say that it makes more sense to #define...

    I'd say that it makes more sense to #define DIRECTORY to be a string literal instead of a token that you then stringify: that way, if you want to say print DIRECTORY for some reason, you just do it....
  22. Replies
    7
    Views
    237

    Ah, now that's different. If hello is a...

    Ah, now that's different. If hello is a parameter, then you do need it to be a pointer to a pointer even when allocating for a dynamic array of codification objects because you want the pointer from...
  23. Replies
    2
    Views
    131

    You forgot to allocate space for the dynamic...

    You forgot to allocate space for the dynamic array, say by calling malloc.
  24. That's because now that you've fixed the syntax...

    That's because now that you've fixed the syntax errors, you still have a logic error to fix. Carefully step through your loop with some test input to see what happens (or does not happen).
  25. That doesn't seem like a particularly useful...

    That doesn't seem like a particularly useful question though since the answer is surely "yes", although it would be more common to say "convert" rather than "reshape".
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4