Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.22 seconds.

  1. Replies
    15
    Views
    259

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

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

    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:
    ...
  4. Replies
    15
    Views
    259

    "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,...
  5. Replies
    1
    Views
    118

    I only joined a bit later hah

    I only joined a bit later hah
  6. Replies
    4
    Views
    345

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

    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.
  8. 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"....
  9. 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?
  10. Replies
    20
    Views
    708

    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.
  11. Replies
    3
    Views
    229

    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.

    ...
  12. Replies
    20
    Views
    708

    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...
  13. Replies
    20
    Views
    722

    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...
  14. Replies
    6
    Views
    294

    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';
  15. Replies
    3
    Views
    315

    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...
  16. Replies
    3
    Views
    315

    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...
  17. Replies
    8
    Views
    904

    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...
  18. Replies
    8
    Views
    904

    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...
  19. 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,...
  20. What is the exact error message?

    What is the exact error message?
  21. Replies
    11
    Views
    762

    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...
  22. Replies
    11
    Views
    762

    The rand function is implementation specific.

    The rand function is implementation specific.
  23. You should include MCU_Config.h and fix the...

    You should include MCU_Config.h and fix the errors. A properly written header file will not result in multiple definition errors when included, even if it is included multiple times.


    Yes, by...
  24. Replies
    8
    Views
    710

    The inline function idea might be worth a try:...

    The inline function idea might be worth a try: while inlining isn't guaranteed, if it does happen (and the code does look like a good candidate for inlining), it may be possible that the compiler...
  25. I would suggest doing a bit more error checking,...

    I would suggest doing a bit more error checking, and making sure that you free what you malloc and fclose what you fopen. For example, you might have something along the lines of:

    int...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4