Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.18 seconds; generated 53 minute(s) ago.

  1. Replies
    2
    Views
    156

    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
    {
  2. 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...
  3. 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...
  4. 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.
  5. Replies
    15
    Views
    380

    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...
  6. Replies
    15
    Views
    380

    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...
  7. Replies
    15
    Views
    380

    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:
    ...
  8. Replies
    15
    Views
    380

    "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,...
  9. Replies
    1
    Views
    176

    I only joined a bit later hah

    I only joined a bit later hah
  10. Replies
    4
    Views
    405

    Where did you find this example? By now you...

    Where did you find this example? By now you should know enough to figure out from context.

    Besides figuring out from context, there's another thing you can do: write a program to test your...
  11. Replies
    4
    Views
    405

    It's the same as your last example, except that...

    It's the same as your last example, except that the return type is pointer to int.
  12. The problem is that when you read the double with...

    The problem is that when you read the double with the previous scanf call, the newline from entering the line of input remains in the input buffer, and this is then read by the scanf call with "%c"....
  13. Can't really call it a bug when the compiler...

    Can't really call it a bug when the compiler still works perfectly fine and remains standard conforming. An odd way of dealing (or just not dealing) with UB, perhaps?
  14. Replies
    20
    Views
    764

    hamster_nz was replying to Nwb, as you can see...

    hamster_nz was replying to Nwb, as you can see from the quote. You should read hamster_nz's post #12 instead.
  15. Replies
    3
    Views
    253

    That doesn't mean anything. The expression is:...

    That doesn't mean anything. The expression is: memcmp(data_in, data_out, sizeof(data_in)) == 0

    That is, it is checking that the memory represented by data_in and data_out contain equal values.

    ...
  16. Replies
    20
    Views
    764

    Salem already provided the example of reading a...

    Salem already provided the example of reading a file.

    You're right to say that if you want to store 10 integers then the size will be 10. Dynamic memory allocation comes into play when you want...
  17. Replies
    20
    Views
    796

    That's not true. It's just rarely used since it...

    That's not true. It's just rarely used since it is the default. Here's a valid example from the C standard:

    extern int max(int a, int b)
    {
    return a > b ? a : b;
    }


    You didn't actually...
  18. Replies
    6
    Views
    320

    That's an interesting claim, so I wrote this...

    That's an interesting claim, so I wrote this program to check:

    #include <stdio.h>

    #define STR1 "CORRECT"
    #define STR2 "WRONG"

    int main(void)
    {
    char ch = 'A', ch2 = 'a';
  19. Replies
    3
    Views
    334

    A quick check shows that musl has a mailing list...

    A quick check shows that musl has a mailing list and IRC channel. Those would be appropriate places to ask concerning specific implementation considerations.

    Premature optimisation is always...
  20. Replies
    3
    Views
    334

    As you may know, this is the optimisation...

    As you may know, this is the optimisation technique known as loop unrolling. As the comments imply, the idea is to minimise branching. Instead of assigning byte by byte, they want to assign many (in...
  21. Replies
    8
    Views
    954

    That's precisely why you don't have to traverse...

    That's precisely why you don't have to traverse the whole vector. Once you find an element that doesn't have an adjacent counterpart, you know for sure it is the odd element as long as the input...
  22. Replies
    8
    Views
    954

    Perhaps the issue is at the level of the...

    Perhaps the issue is at the level of the algorithm rather than the implementation. For example, perhaps it would be more efficient to sort the vector, then do a single pass to find the first number...
  23. Ok, so you fixed an error, but you're still...

    Ok, so you fixed an error, but you're still having an error now. What is your current code and the exact error message?

    Don't just say "still didn't work" without providing such an update,...
  24. What is the exact error message?

    What is the exact error message?
  25. Replies
    11
    Views
    814

    No, but the same seed must produce the same...

    No, but the same seed must produce the same pseudorandom sequence for the same implementation of the standard library. However, standard library implementations can differ, hence across different...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4