Search:

Type: Posts; User: ddutch

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Your: for( int i = 0 ; i == MAXIM ; i++ )...

    Your: for( int i = 0 ; i == MAXIM ; i++ )
    Better could be:
    for( int i = 0 ; i < MAXIM ; i++ )
  2. Replies
    2
    Views
    1,573

    You wrote: "I have 8 bit string and I want...."...

    You wrote: "I have 8 bit string and I want...."
    Just for the record; your "unsigned char buffer[8]" is an array of 8 bytes and it is not 0-terminated so it is not a C-string...
  3. Replies
    6
    Views
    570

    oeps, the for statement should count until x

    oeps, the for statement should count until x < 172 since one byte is needed for the 0 character
  4. Replies
    6
    Views
    570

    It should work but it looks a bit funny to...

    It should work but it looks a bit funny to initialize x with -1 and increase x as long as it is smaller than 171
    and indeed don't forget the terminating 0

    I think the code looks better if you...
  5. #include int main() { unsigned...

    #include <stdio.h>

    int main()
    {
    unsigned char aByte = 1; // == 00000001
    unsigned char myInput = 126; // just some random value which fits inside a byte (unsigned char)
    unsigned...
  6. Replies
    6
    Views
    1,779

    what about: temp->next = malloc(..); temp =...

    what about:
    temp->next = malloc(..);
    temp = temp->next;
    ----
    ....
    temp->next = NULL;
  7. In C, global variables, like myItem are...

    In C, global variables, like myItem are initialized to 0 or NULL by the compiler !
    Item_Array my_array is not a global variable and thus not initialized, only during run-time you assign values of...
  8. Replies
    4
    Views
    1,860

    Your code above will cause runtime problems...

    Your code above will cause runtime problems (segmentation fault) because the pointers iptr and fptr probably do not point to allocated memory
    so you cant assign a value to be contained by that...
  9. Replies
    1
    Views
    2,150

    I once wrote a web-server (which is a long story)...

    I once wrote a web-server (which is a long story) and used epoll. One of the functions I used was epoll_ctl(). Through this function one can determine for example that the client is no longer...
  10. In your very first example you try to copy a...

    In your very first example you try to copy a string into an integer ....
    In your other code snippets, you let a char- pointer point to an already existing array (of chars), that works.
    But in your...
  11. Replies
    6
    Views
    1,522

    Don't want to patronize but your functions must...

    Don't want to patronize but your functions must have and return a certain data-type. Or void if they return nothing.
    Like

    int main()
    {
    ---------
    return(some_integer_value);
    }
  12. Thread: bit field on c

    by ddutch
    Replies
    2
    Views
    1,541

    FYI, the sizeof() a struct foo shows you the...

    FYI, the sizeof() a struct foo shows you the size of an unsigned int ( which on my system is 4 (bytes)).
  13. Through the Tiobe Index you might get an idea of...

    Through the Tiobe Index you might get an idea of their definition of what is a programming language and also of what are the most used/popular programming languages.
    See:
    Programming Languages...
  14. Thread: input check

    by ddutch
    Replies
    9
    Views
    2,207

    The header-file ctype.h shows a whole lot of...

    The header-file ctype.h shows a whole lot of character handling functions.
    Or have a look here: The GNU C Library
  15. Replies
    3
    Views
    1,201

    Use proper indentation.... Start with including...

    Use proper indentation....
    Start with including the appropriate header-files
  16. you might like the C-library function strstr()

    you might like the C-library function strstr()
  17. Replies
    6
    Views
    1,076

    sorry christop, while I was typing you already...

    sorry christop, while I was typing you already sent an answer
  18. Replies
    6
    Views
    1,076

    You can use a pointer to a function and also pass...

    You can use a pointer to a function and also pass the parameter(s) which go with that function.
    It does not look nice/readable but it can be done.
    For example:



    #include <stdio.h>

    void...
  19. The code above is just a general idea, the rest...

    The code above is just a general idea, the rest you have to work out by yourself
  20. You can put the display of the main menu inside a...

    You can put the display of the main menu inside a while-loop which only stops if the user chooses option 3. Also then dsplyPswd() should return 3 and its value should be assigned to the variable...
  21. First of all, this is not correct. You forgot...

    First of all, this is not correct.
    You forgot the space required for the 0-character at the end of yesno

    It is also a good habit to NOT use global variables when you not realy need to., keep...
  22. Thread: calculate hours

    by ddutch
    Replies
    3
    Views
    916

    You can convert date A into a time_t value...

    You can convert date A into a time_t value (seconds passed since 00:00:00 on January 1, 1970) and do the same with date B. Next use difftime()

    In order to convert a certain date into an above...
  23. Thanks for your comments, it can be good for...

    Thanks for your comments, it can be good for portability to be somewhat "pedantic"

    Using the GNU Compiler Collection (GCC): C Dialect Options
  24. Yes indeed, one can not do pointer arithmetic...

    Yes indeed, one can not do pointer arithmetic with void pointer and it is not allowed according to the Ansi C standard.
    But .... in my example above I only use void-pointers in order to obtain 2...
  25. Is it not so that void-pointers are (single) byte...

    Is it not so that void-pointers are (single) byte pointers
Results 1 to 25 of 92
Page 1 of 4 1 2 3 4