Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    1
    Views
    84

    From scanf() manpage: RETURN VALUE On...

    From scanf() manpage:

    RETURN VALUE
    On success, these functions return the number of input items successfully matched and assigned; this can be fewer than provided for, or even zero, in...
  2. Replies
    4
    Views
    109

    Search your feelings... I know there is still...

    Search your feelings... I know there is still good in you...
  3. If you are curious on how to allocate a...

    If you are curious on how to allocate a bidimensional array, here's a tip:

    #include <stdio.h>
    #include <stdlib.h>

    int main( void )
    {
    int i, j;
    int ( *ptr )[][20]; // ptr = pointer to...
  4. Replies
    3
    Views
    86

    Another word of caution: It is said floats has 6...

    Another word of caution: It is said floats has 6 decimal digits (not "fractional digits", but "overall digits") of precision, it doen't mean all decimal fracional values can be store exactly in...
  5. Replies
    3
    Views
    86

    Another thing... when you use literals as...

    Another thing... when you use literals as 3.12345678901234567890 or functions as atan(), you are dealing with double precision (double).

    Literal constants to single precision have 'f' suffix (like...
  6. Replies
    3
    Views
    86

    The "precision" of floating point types is given...

    The "precision" of floating point types is given by the number of significant bits, not the decimal fractional part of the number.
    When it is said 'single precision' has 6 or 7 digits of precision,...
  7. Replies
    6
    Views
    135

    Well... I try to use the "left hand side" rule...

    Well... I try to use the "left hand side" rule used in some C standard functions... As examples:


    // dest is the 'output'
    char *strcpy( char *dest, char *src );

    // 'buffer' is the 'output'...
  8. Replies
    6
    Views
    118

    Ok... your ONLY question: "What am I missing...

    Ok... your ONLY question: "What am I missing here?"
    A: I think you aren't missing anything...
  9. Replies
    6
    Views
    118

    Aren't you overthinking about pointers usage? ...

    Aren't you overthinking about pointers usage?

    // FIX: Returns true if OK, false if allocation fail.
    int push ( Node **head, int new_data )
    {
    Node *new_node = malloc ( sizeof ( Node ) );

    ...
  10. Replies
    2
    Views
    128

    // Assuming string is less then 33 chars long...

    // Assuming string is less then 33 chars long (excluding the '\0').
    // Assuming, also, each char is either '0' or '1'.
    unsigned int bin2int(char *str)
    {
    unsigned int n = 0;

    while ( *str )...
  11. Replies
    2
    Views
    124

    I believe C99 is the most popular nowadays, but...

    I believe C99 is the most popular nowadays, but compilers like GCC [version 7 or superior, I think] uses extended C11 by default (GNUC11).
  12. This doen't seem to be bubble sort, but insertion...

    This doen't seem to be bubble sort, but insertion sort...
    Insertion Sort
    Bubble Sort
  13. Thread: average

    by flp1969
    Replies
    1
    Views
    88

    Change line 20 to: printf( "%f\n", sr );...

    Change line 20 to:

    printf( "%f\n", sr );
    And line 38 to:

    return (double)wynik / n;
  14. Replies
    9
    Views
    204

    Seeing your code I assume you speak portuguese,...

    Seeing your code I assume you speak portuguese, right? I am brazillian and here's one article I wrote sometime ago:

    Deslocando uma string de bits.

    Maybe you adapt this to your needs.
  15. Assembly?

    Assembly?
  16. Replies
    9
    Views
    240

    Exactly! :)

    Exactly! :)
  17. Replies
    9
    Views
    240

    From IOCCC: /* ball.c */ /* Compile with:...

    From IOCCC:


    /* ball.c */
    /* Compile with: 'gcc -ansi -o ball ball.c -lm' */
    /* Works on linux */
    #include <stdio.h>
    #include <math.h>
    #include <unistd.h>
    #include <sys/ioctl.h>
  18. Replies
    3
    Views
    127

    Nope... this function returns 'n*alg', the...

    Nope... this function returns 'n*alg', the average is 'alg'.

    And... if n <= 0 (n is a signed integer!) it will return 'alg*((2łą - abs(n)) + 2łą-2)'.
  19. Is 'byte' a pointer? 'byte+1' isn't a lvalue and...

    Is 'byte' a pointer? 'byte+1' isn't a lvalue and will cause a compilation error... and you are using 'tmp' instead of 'temp', did you notice?
    What this code is supposed to do?
  20. Replies
    4
    Views
    146

    One example of what @Hodor probably meant by "By...

    One example of what @Hodor probably meant by "By using the volatile keyword you're telling the compiler to be very careful about assumptions it might otherwise make":

    int a;
    volatile int b;
    ...
  21. Well... Using 'int' to hold the number of seconds...

    Well... Using 'int' to hold the number of seconds is not that bad. Timestamps, for example, can hold the number of seconds since January 1st 1970 to 2038 using a 32 bits integer (time_t is...
  22. Replies
    17
    Views
    364

    Nooo... really?! ;)

    Nooo... really?! ;)
  23. Replies
    17
    Views
    364

    Hehhee: log xy = log x + log y log x/y = log...

    Hehhee:

    log xy = log x + log y
    log x/y = log x - log y
    log x^y = y * log x

    Simple as this... :)
  24. Replies
    7
    Views
    179

    Another one for your study: /* Compile with...

    Another one for your study:

    /* Compile with GCC:

    gcc -o test test.c

    Add -DDEBUG with you want to see 'debug' messages. */
    #define _GNU_SOURCE
    #include <stdlib.h>
    #include <stdio.h>
  25. Replies
    2
    Views
    168

    Depends on the compiler optimization. Could be on...

    Depends on the compiler optimization. Could be on registers.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4