Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.30 seconds.

  1. Replies
    4
    Views
    141

    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...
  2. Replies
    4
    Views
    141

    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...
  3. Replies
    2
    Views
    167

    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
    {
  4. 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...
  5. 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...
  6. 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.
  7. Replies
    15
    Views
    392

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

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

    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:
    ...
  10. Replies
    15
    Views
    392

    "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,...
  11. Replies
    1
    Views
    197

    I only joined a bit later hah

    I only joined a bit later hah
  12. Replies
    4
    Views
    425

    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...
  13. Replies
    4
    Views
    425

    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.
  14. 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"....
  15. 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?
  16. Replies
    20
    Views
    781

    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.
  17. Replies
    3
    Views
    263

    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.

    ...
  18. Replies
    20
    Views
    781

    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...
  19. Replies
    20
    Views
    823

    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...
  20. Replies
    6
    Views
    325

    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';
  21. Replies
    3
    Views
    343

    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...
  22. Replies
    3
    Views
    343

    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...
  23. Replies
    8
    Views
    977

    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...
  24. Replies
    8
    Views
    977

    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...
  25. 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,...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4