Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

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

  1. Replies
    4
    Views
    58

    Problematic: #ifndef SIZE_END_BIT ...

    Problematic:



    #ifndef SIZE_END_BIT

    #define SIZE_END_BIT ~(SIZE_MAX>>1)

    #endif
  2. void dosomething( int *p ) { *p = 1; } void...

    void dosomething( int *p )
    { *p = 1; }

    void print( int *p )
    { printf( "%d\n", *p ); }

    int main ( void )
    {
    int x;
  3. Replies
    5
    Views
    191

    Ask yourself: "What is the origin for a 'child'...

    Ask yourself: "What is the origin for a 'child' window?" Is it the "desktop" or its parent window? And what if you have multiple monitors?
  4. Replies
    20
    Views
    331

    Even more: The pre-processor "code" below will...

    Even more: The pre-processor "code" below will always result in CHAR_BIT == 8:


    #ifndef CHAR_BIT
    #if ~0 << 8
    #define CHAR_BIT 8
    #elif ~0 << 7
    #define CHAR_BIT 7
    #elif ~0 << 6
    #define...
  5. Replies
    12
    Views
    342

    BMP file format - Wikipedia...

    BMP file format - Wikipedia
  6. Replies
    1
    Views
    90

    Google or DuckduckGo are your friends. Use...

    Google or DuckduckGo are your friends. Use them...

    ODBC from C Tutorial Part 1
  7. Replies
    13
    Views
    297

    You are aware that any recursive routine can be...

    You are aware that any recursive routine can be made without recursion, right?

    Here's a quicksort without recursion (using an allocated stack):

    #include <stdio.h>
    #include <stdlib.h>
    ...
  8. Replies
    13
    Views
    297

    Do you mind to clarify?

    Do you mind to clarify?
  9. Replies
    13
    Views
    297

    A more "generic" approach: #include ...

    A more "generic" approach:

    #include <stdlib.h>

    // Comparison funcions named after type and identifier.
    #define QSORT_CMP_FN_ASC(T,FN) FN ## _ ## T ## _A
    #define QSORT_CMP_FN_DESC(T,FN) FN ##...
  10. Replies
    13
    Views
    297

    #define INTARRAY_ELEMENTS(a) \ (sizeof a /...

    #define INTARRAY_ELEMENTS(a) \
    (sizeof a / sizeof a[0])

    static int cmp( const void *ap, const void *bp )
    { return (*(int *)ap > *(int *)bp) - ( *(int *)ap < *(int *)bp ); }

    ...
    int...
  11. Replies
    2
    Views
    155

    This is a null expression. The use of (void)...

    This is a null expression. The use of (void) there is an attempt to avoid a compiler warning... Not really necessary (because the expression is null, but valid).
  12. Replies
    3
    Views
    180

    No problems here: $ cc -g -o test test.c $...

    No problems here:

    $ cc -g -o test test.c
    $ echo 'test' > input
    $ gdb test
    Reading symbols from test...done.
    (gdb) r < input
    Starting program ./test < input
    test
    [Inferior 1 (process 8995)...
  13. This is WRONG: int index; while ( ( index...

    This is WRONG:


    int index;

    while ( ( index = strstr( str1, str2 ) ) != NULL ) ...
  14. You could keep 'sum' as integer (with more...

    You could keep 'sum' as integer (with more precision then individual values) and just convert to 'long double' (which have the same precision, in bits, as 'long long') when you calculate the mean:
    ...
  15. Thread: Run a program

    by flp1969
    Replies
    3
    Views
    255

    Hehehe... ;)

    Hehehe... ;)
  16. Replies
    12
    Views
    380

    I really don't get it... Do you realize that a...

    I really don't get it... Do you realize that a "byte" is 8 bits, so, by definition "binary data", don't ya?
  17. Yep, I notice... Since did a good try I thought...

    Yep, I notice... Since did a good try I thought it wasn't that harmul to show a different approach...
  18. Odd numbers between 20 and 100 are between 21...

    Odd numbers between 20 and 100 are between 21 (not 19) and 99:


    #include <stdio.h>

    int main( void )
    {
    int n = 21; // first odd value between 20 and 100.
    int sum = 0;
  19. I strongly recommend that you don't use floating...

    I strongly recommend that you don't use floating point types with currency calculations.

    Because of the nature of floating point implementation, most values aren't exact and due to rounding, some...
  20. As said here before, floating point values are...

    As said here before, floating point values are (often) approximations. Furthermore, they are binary representations of rational values (ℚ domain), not real values (ℝ domain). A decimal value,...
  21. Replies
    1
    Views
    234

    gSOAP (https://www.genivia.com/dev.html)

    gSOAP
  22. Replies
    4
    Views
    297

    Aren't you forgetting about multibyte charsets?

    Aren't you forgetting about multibyte charsets?
  23. int count_digits( char *s ) { int counter =...

    int count_digits( char *s )
    {
    int counter = 0;

    for (; *s; s++ )
    if ( isdigit( *s ) )
    counter++;

    return counter;
    }
  24. Replies
    4
    Views
    401

    From the wiki article: "All of the integer...

    From the wiki article:

    "All of the integer values are stored in little-endian format (i.e. least-significant byte first)."
  25. Replies
    3
    Views
    842

    IF you are using a multibyte charset (UTF-8, for...

    IF you are using a multibyte charset (UTF-8, for example) you should convert this string to wchar_t string and use wcsrchr() instead of strchr():


    /* test.c */
    #include <stdlib.h>
    #include...
Results 1 to 25 of 499
Page 1 of 20 1 2 3 4