Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.16 seconds.

  1. It is impossible for the caller of get_next_line...

    It is impossible for the caller of get_next_line to call the equivalent of free(s) as s is never returned.


    That's exactly what I was talking about, hence I mentioned that "the very last call...
  2. In get_line, I noticed: line = ft_substr(*s,...

    In get_line, I noticed:

    line = ft_substr(*s, 0, i);
    tmp = *s;
    *s = ft_substr(tmp, i, ft_strlen(tmp) - i);
    free(tmp);
    return (line);
    ft_substr returns a string allocated by malloc. The string...
  3. Replies
    17
    Views
    607

    Best to clarify the "necklace" with your...

    Best to clarify the "necklace" with your instructor before settling on a solution.
  4. What probably happened is that the lambda...

    What probably happened is that the lambda function was inlined, so the end result was the same.

    john.c's swapping idea might work, but if you're doing something a bit more complex, another...
  5. Replies
    5
    Views
    441

    I'd say it's a matter of style: as n is an array,...

    I'd say it's a matter of style: as n is an array, the address resulting from implicitly converting n to a pointer and from &n is the same. Since you're coercing the type anyway, there is thus no...
  6. Replies
    10
    Views
    520

    A quick check shows that libpng is open source,...

    A quick check shows that libpng is open source, so you can always peruse the source code to find out.
  7. I am afraid that I have not yet had time to play...

    I am afraid that I have not yet had time to play around with modules, and what you described doesn't sound like how I expect them to work from what I recall reading on them. I suggest that you post a...
  8. Replies
    4
    Views
    464

    You need to read the next sentence for the...

    You need to read the next sentence for the context, i.e., Malcolm McLean is trying to address the criticism that the name "RAII" is misleading by giving it a more limited meaning and thus is able to...
  9. Replies
    13
    Views
    551

    How do you plan to implement the priority queue?

    How do you plan to implement the priority queue?
  10. Simple typo error: the word is "namespace", not...

    Simple typo error: the word is "namespace", not "nsmespace". Having said that, this using directive should be placed after the last header inclusion so as to avoid affecting the contents of the...
  11. Replies
    4
    Views
    543

    What is the test that fails? If you were not...

    What is the test that fails?

    If you were not given the test values, then you should write your own 9 tests that try to replicate what your instructor is testing. Knowing what is the failing test...
  12. Replies
    1
    Views
    391

    Sounds good. What's your plan, what have you done...

    Sounds good. What's your plan, what have you done thus far, and what help do you need?
  13. Thread: Macro help

    by laserlight
    Replies
    3
    Views
    472

    I can't say I've ever had reason to use the...

    I can't say I've ever had reason to use the feature myself, but variadic macros were introduced in C99.
  14. Replies
    15
    Views
    1,046

    No, it isn't, not at all. I demonstrated bundling...

    No, it isn't, not at all. I demonstrated bundling the head and tail in a single structure as an abstraction of a singly linked list that also keeps track of its tail, since Djsarkar was originally...
  15. Replies
    7
    Views
    1,441

    But how? The code that you provided does not have...

    But how? The code that you provided does not have any static data members (or any data members at all) so "static member data can be shared across all instances" is obviously not a reason. There are...
  16. Replies
    7
    Views
    1,441

    Err... the fact that you're listing four options...

    Err... the fact that you're listing four options that are rather different is rather weird. It is almost as if this is some MCQ question for a homework assignment and you're hoping someone will just...
  17. Replies
    7
    Views
    1,441

    The static keyword here just designates the...

    The static keyword here just designates the member function as a static member function. You could just as easily use a non-member function, except that it makes sense to associate the function more...
  18. Replies
    2
    Views
    392

    If you're dealing with a linked list that has...

    If you're dealing with a linked list that has both head and tail, then I would suggest something like this:

    struct Node
    {
    int Value;
    struct Node *Next;
    };

    struct LinkedList
    {
  19. The simple answer is: no, because it is invalid...

    The simple answer is: no, because it is invalid syntax.

    There may be some edge case or whatever where this is not true, but I don't feel like researching it, especially not when it'll probably...
  20. You've been told to make use of learning material...

    You've been told to make use of learning material like introductory books that would explain these to you. Do that.

    If you want to do exploratory learning, well, that's not necessarily wrong, but...
  21. The output is obviously different. Ok, maybe not...

    The output is obviously different. Ok, maybe not that obvious, but that's because you printed so many lines when just a few critical ones would have done the job.
  22. Replies
    15
    Views
    844

    Yeah, but isn't this futile? Everyone has their...

    Yeah, but isn't this futile? Everyone has their own preferences, e.g., I feel three spaces before a trailing comment is unnecessary, but frankly, it looks alright.

    When I think of flaws, I think...
  23. Replies
    15
    Views
    844

    Yeah, refer to my edit: I realised that I misread...

    Yeah, refer to my edit: I realised that I misread the post because I was led astray by the question and sample solutions given in the linked page instead of reading your explanation carefully. No...
  24. Replies
    15
    Views
    844

    EDIT: Oh wait, I think I understand now. ...

    EDIT:
    Oh wait, I think I understand now.

    You're not talking about programming in C to improve some sample solutions that you encountered. You're talking about whether calling this command:
    ...
  25. Replies
    15
    Views
    844

    "Indent" usually means something like "place the...

    "Indent" usually means something like "place the text at some offset relative to the current margin", hence the common notion of indenting code by a certain number of spaces. What you're doing here,...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4