Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    6
    Views
    273

    Undefined behavior.

    Undefined behavior.
  2. Replies
    6
    Views
    216

    ███████████████████████████████████████...

    ███████████████████████████████████████
    █████████████▓▒░░░░░░░░▒███████████████
    ███████████▓░░░░░░░░░░░░░▒█████████████
    ██████████▒░░░▓▓░░░░░░░░░░░▓███████████...
  3. Replies
    6
    Views
    216

    One thing to notice on John's code: ... int...

    One thing to notice on John's code:

    ...
    int main()
    {
    int n = 0;
    int guess=0;
    char answer[14];

    srand(time(0));
  4. Replies
    6
    Views
    216

    It is not true if you allocate an array of 14...

    It is not true if you allocate an array of 14 bytes it will ocuppy 14 bytes on stack... It can ocupy from 16 to 32 bytes, depending on optimizations, platform and alignment.

    It is not true that...
  5. Thread: f-write stdout

    by flp1969
    Replies
    12
    Views
    319

    Then, I suggest you start to study how to print...

    Then, I suggest you start to study how to print floating point values from scratch. It's not a simple task:

    How to print floating point numbers accurately
  6. static but global! It WILL keep the value between...

    static but global! It WILL keep the value between funcion calls.
  7. Because you are doing nothing. Here's an example:...

    Because you are doing nothing. Here's an example:


    #include <stdio.h>

    typedef void ( *action )( void );

    static int i = 0;
    static void pusty( void ) { i++; }
    // ^^^^^
  8. Replies
    4
    Views
    184

    Notice if you use the same pointer as an argument...

    Notice if you use the same pointer as an argument and return to realloc() call you can end up with a memory leakage if realloc() fails. It is wise to use different pointers. Your code, changed a...
  9. Thread: Pointer help

    by flp1969
    Replies
    27
    Views
    753

    ;)...

    ;)...
  10. Thread: Pointer help

    by flp1969
    Replies
    27
    Views
    753

    I'm getting there. Past my 5th decade... Here's a...

    I'm getting there. Past my 5th decade... Here's a good read about floating point if you are interested: Handbook of Floating Point arithmetic.

    []s
    Fred
  11. Thread: Pointer help

    by flp1969
    Replies
    27
    Views
    753

    Another example why floating point is another...

    Another example why floating point is another beast entirely:

    #include <stdio.h>

    #define SHOW_RESULT(c) \
    printf("[%s]\n", ((c))?"yes":"no")

    void testfp1 ( void )
    {
    double x = 1.2;
  12. Thread: Pointer help

    by flp1969
    Replies
    27
    Views
    753

    I must point out that, conceptually, using a loop...

    I must point out that, conceptually, using a loop instead of a bunch of calls to `pow()`, inline, is correct, but you are dealing with floating point here and floating point aren't exact...
  13. Replies
    12
    Views
    388

    Are you aware that C isn't Python, don't ya?

    Are you aware that C isn't Python, don't ya?
  14. Replies
    23
    Views
    1,122

    "pie" is undefined when calculating "diameter"....

    "pie" is undefined when calculating "diameter". Why calculate "radius" since you got it in scanf()?
    There is a M_PI constant in math.h. And you don't need stdlib.h.
  15. Replies
    23
    Views
    1,122

    If diameter is 2 times radius, 2 times PI times r...

    If diameter is 2 times radius, 2 times PI times r is the same as PI times diameter!

    And your code uses unecessary headers. Take a look at this simplification:

    // circ.c
    //
    // Compile with:...
  16. Replies
    4
    Views
    437

    Same tip as Salem's here... Use strtol() or...

    Same tip as Salem's here... Use strtol() or strtoul() functions. Observe that C99 also offers strtoll() and strtoull() for 'long long int's...
  17. Replies
    7
    Views
    449

    I am assuming the CGI processor spawns a process...

    I am assuming the CGI processor spawns a process and, in case of failure (disconnections, for example) it simply kills the process. I don't know how you are dealing with errors in your CGI...

    In...
  18. Replies
    7
    Views
    449

    What do you mean by 'large'? Several characters...

    What do you mean by 'large'? Several characters or loads of megabytes of them?
  19. Nice! ;)

    Nice! ;)
  20. Replies
    7
    Views
    645

    Change to Linux... I did it 17 years ago. No...

    Change to Linux... I did it 17 years ago. No regrets! :)
  21. Not that your strrev() is wrong, but I prefer to...

    Not that your strrev() is wrong, but I prefer to follow C's standard library philosophy and assume the arguments are correct and test/initialize them outside the funcion. I would implement strrev()...
  22. Replies
    3
    Views
    411

    Thanks, laserlight. I am using gcc 7.3 and 8.4...

    Thanks, laserlight.

    I am using gcc 7.3 and 8.4 (available in Ubuntu repos). Good to know they finally corrected this.

    []s
    Fred
  23. Replies
    3
    Views
    411

    Ahhhh... my locale setting: $ set | grep ^LC...

    Ahhhh... my locale setting:

    $ set | grep ^LC
    LC_ADDRESS=pt_BR.UTF-8
    LC_CTYPE=pt_BR.UTF-8
    LC_IDENTIFICATION=pt_BR.UTF-8
    LC_MEASUREMENT=pt_BR.UTF-8
    LC_MONETARY=pt_BR.UTF-8
    LC_NAME=pt_BR.UTF-8...
  24. Replies
    3
    Views
    411

    GCC not following C99+?

    Please, check my interpretation:

    ISO 9989:1999 and later says in topic 5.2.1.2:

    "An identifier, comment, string literal, character constant, or header name shall consist of a sequence of valid...
  25. Replies
    3
    Views
    394

    Yep.. use open() to get a file desciptor and... ...

    Yep.. use open() to get a file desciptor and...



    ... there is a special syscall to deal with devices: ioctl(), to send "commands" to control the device. Those commands are device dependent...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4