Search:

Type: Posts; User: flp1969

Page 1 of 20 1 2 3 4

Search: Search took 0.02 seconds; generated 34 minute(s) ago.

  1. Replies
    1
    Views
    48

    int is 32 bits long (UINT_MAX = 4294967295) long...

    int is 32 bits long (UINT_MAX = 4294967295)
    long long is 64 bits long
    double is 53. Try:


    bool is_triangular( unsigned long long t )
    {
    unsigned long long delta = 1ULL+8ULL*t;
    long...
  2. Replies
    4
    Views
    139

    Nope... the last byte in memory which marks the...

    Nope... the last byte in memory which marks the end of string is ZERO ('\0'), not '\n'.

    If your string has a variable size, than you need to allocate enough space to contain every char, including...
  3. Replies
    12
    Views
    130

    Well... As far as I know, the telepathic...

    Well... As far as I know, the telepathic interface was not invented yet.
  4. Replies
    12
    Views
    130

    Almost the same code: #include ...

    Almost the same code:

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

    int main ( void )
    {
    int numberGuess;
    int computerGuess;
    int count;
  5. Replies
    12
    Views
    130

    Notice for the rage from 1 to 100, 7 tries will...

    Notice for the rage from 1 to 100, 7 tries will always "win", since
    16318
  6. Replies
    3
    Views
    230

    Reading/Writing unaligned data always has a...

    Reading/Writing unaligned data always has a performance penalties (specially on Intel/AMD processors).
  7. Replies
    12
    Views
    130

    One observation: 16317

    One observation:

    16317
  8. I din't analize your code, but one thing you have...

    I din't analize your code, but one thing you have to do is to tell SDL2 the type of context of OpenGL you are using. Nowadays OpenGL expects CORE PROFILE, but you are using COMPATIBLE PROFILE. So,...
  9. Replies
    16
    Views
    383

    "would be"...

    "would be"...
  10. Replies
    16
    Views
    383

    My approach is only to show that he doesn't need...

    My approach is only to show that he doesn't need to use strlen(), strcpy(), strcat() approach and to limit the size of output string... But, of course, if both original strings are limited to 100...
  11. Replies
    16
    Views
    383

    char str1[] = "john"; char str2[] = "abbey"; ...

    char str1[] = "john";
    char str2[] = "abbey";

    char *r1, *r2;

    // FIXME: Should test if asprintf returns negative value!
    // Must remember to free() the buffers afterwards.
    asprintf( &r1,...
  12. Replies
    5
    Views
    267

    I would change only: To Is a is house, &a...

    I would change only:

    To

    Is a is house, &a is the address of the house. Same to "house" p.
  13. Replies
    3
    Views
    260

    I really hope this is not a project you got by...

    I really hope this is not a project you got by curiosity, because decoding an audio containing morse code isn't that easy.

    First, your code must be aware of "noise". One way to do it is to...
  14. And... sorry... I made a little mistake... To...

    And... sorry... I made a little mistake... To emulate && with the binary logical operator & you need to transform the values in both variables to boolean (0 or 1), like this:

    x += ( !!x & !!b );...
  15. Always a good idea to give a hand to the...

    Always a good idea to give a hand to the compiler, but be aware that it's not granted that a C jumpless code is compiled to a binary jumpless one...

    Usually, when using optimizations, the compiler...
  16. Just another tip... notice that there are BOOLEAN...

    Just another tip... notice that there are BOOLEAN operators and BINARY operators for logical operations... The expression above could be writen as:

    x += ( x && boolvar );
  17. Replies
    1
    Views
    296

    Take a look at OpenCL.

    Take a look at OpenCL.
  18. Vague? ISO defines the result of boolean...

    Vague? ISO defines the result of boolean expressions to be 0 (false) or 1 (true). But for testing boolean values, 0 is false and non-zero, true.

    I would use

    #define FALSE 0
    #define TRUE 1
    ...
  19. Replies
    3
    Views
    244

    When data on a stream cannot be converted it...

    When data on a stream cannot be converted it stays in the stream buffer. When you type 'bob' scanf() will return 0 and "bob\n" will stay in the stdin's buffer... the latter scanf() will read 1 char...
  20. Thread: Tricky typedef

    by flp1969
    Replies
    5
    Views
    345

    Trying to explain the declaration... This: ...

    Trying to explain the declaration... This:

    unsigned int func( void *p );
    Is a function named func which returns an unsigned int and takes a pointer to void as argument, right?

    This:
    ...
  21. Not an anomaly... Someone shown me this and I got...

    Not an anomaly... Someone shown me this and I got directly to ISO standard (C99) and it is there... It's a valid expression.
    Does nothing really (except create that annonymous automatic object) --...
  22. An interesting and strange (in my opinion) expression.

    I was amazed to learn that this works:


    (int){ 0 } = 1;
  23. Replies
    10
    Views
    519

    Incomplete array declarations can be "incomplete"...

    Incomplete array declarations can be "incomplete" only in the "first" dimension. The reason is this: Suppose you have an array like yours:

    int arr[421][69];
    To access the element arr[i][j] the...
  24. Replies
    3
    Views
    288

    I strongly recommend to avoid using system() in...

    I strongly recommend to avoid using system() in any project. And I think Salem is right saying this is better suited to a script/batch file. Just as an exercise here's my implementation using...
  25. This happens because VLAs don't have a known...

    This happens because VLAs don't have a known constant length (ISO 9899 6.2.5 23). The compiler don't know the size of the array (even if you use a pre initialized size through a 'const' variable)...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4