Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.01 seconds; generated 31 minute(s) ago.

  1. Replies
    4
    Views
    120

    80 bits, with 64 bits precision. 'long double'...

    80 bits, with 64 bits precision. 'long double' tends to occupy 16 bytes on memory due to alignment.

    There is an extension on GCC (and, I believe, clang): __float128 (128 bits, 113 bits precision).
  2. Replies
    2
    Views
    34

    Since Ackerman recursion cannot be called with...

    Since Ackerman recursion cannot be called with negative values:

    unsigned int ackermann(unsigned int m, unsigned int n)
    {
    if (!m) return n + 1;
    if (!n) return ackermann(m - 1, 1);
    return...
  3. Replies
    5
    Views
    238

    What test didn't pass? And you should ask...

    What test didn't pass?

    And you should ask yourself if, for example, 0.5 is even or odd.
    It doesn't make any sense asking if a fraction, resulting in a non integer value, is even or odd...
    ...
  4. Replies
    3
    Views
    161

    Is this right? Maybe: int nfields =...

    Is this right?

    Maybe:

    int nfields = sscanf(line, "%d %d %d %d", &d1, &n1, &d2, &n2);
  5. Replies
    3
    Views
    206

    Another tip, using only ISO functions from...

    Another tip, using only ISO functions from string.h:


    char *foo( char *s )
    {
    char *p;
    char tmp;
    ssize_t size;

    // get the size of final string.
  6. Replies
    10
    Views
    355

    I prefer to deal with pointers: #define...

    I prefer to deal with pointers:


    #define ARRAY_TEMS(a) (sizeof a / sizeof a[0])
    int x[] = { 1, 2, 3, 4 };
    int y[] = { 6, 7, 8, 9 10 };
    int z[9]; // must have enough space to both x[] and y[]...
  7. Replies
    10
    Views
    355

    Well... it depends... int a[4], *p = &a[2];...

    Well... it depends...

    int a[4], *p = &a[2];
    p[-2] = 0; // valid!. same as a[0].
  8. Replies
    6
    Views
    254

    (1

    (1 << 4) in binary: 0b10000

    It is 00001 shifted left 4 bits.

    0b10000 - 1 = 0b1111 (all 4 bits set).

    Let's say you want only 1 bit set:

    (1 << 1) - 1 = 0b0010 - 1 = 0b0001
  9. Replies
    3
    Views
    225

    Please, put srand(time(NULL)) outside the loop....

    Please, put srand(time(NULL)) outside the loop. Inside you risk not getting "random" values with rand(). The seed must be provided only once in your program.
  10. Replies
    6
    Views
    254

    Don't need a loop: int nibbles = (1

    Don't need a loop:

    int nibbles = (1 << 4) - 1;
  11. Replies
    2
    Views
    157

    Something like this? static void...

    Something like this?

    static void do_nothing(int sig) {}
    ...
    signal( SIGALRM, do_nothing );

    alarm(3);
    errno = 0;
    write( ... );
    if ( errno == EINTR ) puts( "timedout" );
  12. You need to read the documentation, write some...

    You need to read the documentation, write some code, link with the libraries and voilą!
  13. For Linux/FreeBSD I recomend ALSA and ffmpeg (lav...

    For Linux/FreeBSD I recomend ALSA and ffmpeg (lav libraries)... You can try to use SDL sound libraries as well...
  14. Replies
    11
    Views
    320

    One little thing, thou... this: #include...

    One little thing, thou... this:

    #include <stdio.h>

    int main( void )
    {
    int number = -987;
    int reverse = 0;

    while ( number > 0 )
  15. Trivial, but your code has several errors...

    Trivial, but your code has several errors (exemple: shifting a signed integer left) and since this is a C language programming forum, it is completely wrong...

    Here's a more direct way to convert...
  16. Replies
    5
    Views
    221

    Pendulum...

    Pendulum
  17. As Salem told you, this code is an old code for...

    As Salem told you, this code is an old code for MS-DOS and won't work on WINDOWS!
  18. The compiled final code isn't just YOUR code....

    The compiled final code isn't just YOUR code. There is an initialization and finalization codes as well. This 'initialization' code calls main(), in console applications, but Windows calls WinMain()...
  19. Replies
    1
    Views
    119

    Nope: #define clear_bit( v, bit ) ( (v) &...

    Nope:


    #define clear_bit( v, bit ) ( (v) & ~(1U << (bit)) )
    #define set_bit( v, bit ) ( (v) | (1U << (bit)) )
    #define toggle_bit( v, bit ) ( (v) ^ (1U << (bit)) )
  20. rename(3) - Linux manpage...

    rename(3) - Linux manpage
  21. manpages and gdb are your friends... use them...

    manpages and gdb are your friends... use them...
  22. Replies
    4
    Views
    198

    Or, declare a pointer to a function and...

    Or, declare a pointer to a function and initialize this pointer to the static function:


    /* module1.c */
    static int f( int x ) { return x + x; } // visible to this module only;
    int...
  23. Replies
    1
    Views
    141

    1- A pointer variable holds an address which...

    1- A pointer variable holds an address which points to a single memory location. malloc() alocates (reserves) a block of memory and returns the address of the first byte;

    2- Yes... The NULL...
  24. Replies
    15
    Views
    563

    Nope... 'ą' is UTF+00E0 and 0xE0 is 224, not 133....

    Nope... 'ą' is UTF+00E0 and 0xE0 is 224, not 133. What you are asking for is the code of 'ą' using WINDOWS-1252 (probably) codepage (or a variation of ISO-8859-1 or Latin-1).
  25. Did you search on MSDN? Here's an example (not...

    Did you search on MSDN? Here's an example (not quite what you want, but it is a start): Capturing an image
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4