Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds.

  1. XOR has 3 basic uses: To invert bits based in a...

    XOR has 3 basic uses: To invert bits based in a mask; To get the result of different bits in both operands or as a caryless add.
    This kind of code is a trick to swap values without using a temporary...
  2. Replies
    9
    Views
    215

    UNICODE encoding is a 31 bits value corresponding...

    UNICODE encoding is a 31 bits value corresponding to a single character. The trailing 16 bits correspond to a character in a "plane" the upper 16 bits. Actually planes 0, 1, 2, 3, 14, 15 and 16 are...
  3. Replies
    17
    Views
    271

    Easier if you check only if the next value is...

    Easier if you check only if the next value is greater than the previous (or vice-versa).
  4. Replies
    7
    Views
    156

    Didn't you mean how to get the PID of the process...

    Didn't you mean how to get the PID of the process dispatching the signal? Because the PID of the process "calling" the handler will be the same as the process which the handler was registered by...
  5. Replies
    7
    Views
    156

    Didn't you mean how to get the PID of the process...

    Didn't you mean how to get the PID of the process dispatching the signal? Because the PID of the process "calling" the handler will be the same as the process which the handler was registered by...
  6. As Salem said... break your code in small...

    As Salem said... break your code in small portions. Here's my implementation with comments for your study:

    // cobalt.c
    //
    // Compile and link:
    //
    // $ gcc -O2 -o cobalt cobalt.c # add -lm if...
  7. Here's a brief explanation about 'floating point'...

    Here's a brief explanation about 'floating point' based on Salem's correct comments on the subject above.

    "Precision" is the number of significative digits (in this case, BITS) of a...
  8. Replies
    1
    Views
    112

    %[^...] means the same as %s but excludes those...

    %[^...] means the same as %s but excludes those characters (in your case from '0' to '9' and '-').

    Another thing: scanf() returns EOF only if any of the conversions can't be done and if you reach...
  9. Replies
    3
    Views
    180

    Since + has higher precedence than

    Since + has higher precedence than <<, (1U << i + 1) is correct, no parentesis needed.

    I could agree that writing (1U << (i + 1)) makes the expression clearer, but the previous isn't wrong.
  10. Replies
    10
    Views
    347

    In my example code here's some ways to avoid...

    In my example code here's some ways to avoid using goto in this fragment:


    if ( scanf ( "%lf%c + %lf = %lf", &a, &y, &b, &c ) != 4 )
    {
    invalid_input:
    puts ( "Invalid input!" );
    ...
  11. Replies
    10
    Views
    347

    As John says, for beginners, yes... goto should...

    As John says, for beginners, yes... goto should be avoided, even for experienced programmers, but it isn't always 'bad'.

    And. yes... I do know what I am talking about.
  12. Replies
    10
    Views
    347

    Why not? Just because Dijkstra told you so? ...

    Why not? Just because Dijkstra told you so?

    And fflush(stdout) is there not because scanf(), but because stdout is line buffered. Not all c libraries garantees the flushing of the buffer just...
  13. Replies
    10
    Views
    347

    scanf() returns the number of convertions made. ...

    scanf() returns the number of convertions made.

    You should test if a is zero before trying to use it as a divisor.

    %lf in printf() has a different meaning than on scanf().

    You don't need...
  14. Thread: fgets and size

    by flp1969
    Replies
    4
    Views
    244

    If your compiler/c standard library is POSIX:2008...

    If your compiler/c standard library is POSIX:2008 compliant you can use getline() function, which will allocate the buffer for the line for you:


    char *line;
    size_t size;

    // Need this for...
  15. Replies
    4
    Views
    755

    Start? Where is YOUR code?

    Start? Where is YOUR code?
  16. Replies
    8
    Views
    344

    Avoid using system(). Since you are using...

    Avoid using system(). Since you are using Windows, use the Console API do clear the screen:

    #include <windows.h>
    ...
    void clearscreen(void)
    {
    HANDLE hConsole;
    COORD coord = {0, 0};
    ...
  17. Thread: Math help?

    by flp1969
    Replies
    2
    Views
    213

    Are you sure? The final value must be...

    Are you sure? The final value must be 8.6805553436279296875 in single precision (8.68055555556 cannot be represented in any floating point precision).
  18. Is this right? SinglyLinkedListNode *temp =...

    Is this right?

    SinglyLinkedListNode *temp = head->next;
  19. Replies
    1
    Views
    212

    That's because 'E' is used in floating point...

    That's because 'E' is used in floating point literals. The compiler thinks 0xE+1 is nnnE+1 as in 3.14e+1 literal. Try to use (0xE)+1 instead.
  20. Unfortunately, this doesn't work on Windows....

    Unfortunately, this doesn't work on Windows. Here's the same code, using fopen() (test.exe) and _wfopen() (test2.exe). Notice that in file explorer the created flie is shown with the "correct" name...
  21. The test code is simply: if ( ! ( f = _wfopen(...

    The test code is simply:

    if ( ! ( f = _wfopen( L"履歴書.txt", L"w,ccs=UTF-8" ) ) )
    { perror( "_wfopen" ); exit(1); }
    fclose( f );
  22. Sorry... it is not a code, but an image of file...

    Sorry... it is not a code, but an image of file explorer, showing the name correctly.
    I'am getting ???.txt on terminal, but on file explorer is correct.
  23. Here worked fine. The problem, it seems, is the...

    Here worked fine. The problem, it seems, is the Windows terminal don't recognize UNICODE:

    16219
  24. ISO 9899 accepts limited sets of multibyte...

    ISO 9899 accepts limited sets of multibyte charsets like UNICODE, as defined in Annex D of the standard. Including using multibyte charset with identifiers (thou some compilers don't respect this -...
  25. Replies
    8
    Views
    420

    I believe the listing is self explanatory.

    I believe the listing is self explanatory.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4