Search:

Type: Posts; User: aghast

Page 1 of 6 1 2 3 4

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

  1. Something like this, maybe: Coroutines in C...

    Something like this, maybe: Coroutines in C
  2. When C was first implemented, they used 0 to mean...

    When C was first implemented, they used 0 to mean a pointer that had no value.

    This was because a 0 pointer had no meaning on their systems.

    However, when they started spreading C to other...
  3. Thread: Using pointers

    by aghast
    Replies
    6
    Views
    2,935

    You could certainly write strcat using pointers....

    You could certainly write strcat using pointers. But why would you want to? Far better to write strecat:



    #define EMPTY /*EMPTY*/

    char *
    strecat(
    char *dst,
    const char *src)
  4. Thread: A memory leak

    by aghast
    Replies
    14
    Views
    4,635

    It appears that you are using equality in your...

    It appears that you are using equality in your range-top comparison. That is, count <= MAX. You do the same thing in your fibonacci routine. This means it is possible to enter the array size limit as...
  5. Replies
    24
    Views
    7,929

    I cannot answer the questions because they are...

    I cannot answer the questions because they are policy questions, not technical ones. Nothing I have shown you will fail to work depending on how you decide - the questions are just things that invite...
  6. Replies
    24
    Views
    7,929

    Consider this: 1. Create a const, static...

    Consider this:

    1. Create a const, static table of character mappings. It would map the entire 8-bit character range to either itself or '.'

    2. On entry, loop over each character in the...
  7. You're having the same problem, only backwards. ...

    You're having the same problem, only backwards.

    The C compiler can traditionally do a lot of things, and that is causing your confusion. Specifically, the compiler can also invoke the linker, ld,...
  8. Replies
    1
    Views
    3,216

    Don't. You want the exact opposite of a "clever...

    Don't. You want the exact opposite of a "clever way."

    Try using a struct, instead:



    struct {
    int8_t bp_pin_id;
    uint8_t bp_bit_mask;
    int8_t bp_set_state;
  9. Replies
    3
    Views
    3,312

    I found a gtk header file online that contains...

    I found a gtk header file online that contains keysym definitions. I believe that 0xffb5 is KP_5. There are, of course, KP_0 through KP_9 definitions.

    However, as you point out there are plenty...
  10. Try downloading this package: Debian -- Details...

    Try downloading this package: Debian -- Details of package wamerican-huge in buster

    There are other packages, for en_uk and the like, but that should get you started.
  11. Replies
    3
    Views
    3,144

    You are scanning the phone field with %s....

    You are scanning the phone field with %s. Remember that %s stops on white space, so if someone types a complex phone string this will break. You probably should use the same pattern you used for the...
  12. Replies
    8
    Views
    3,929

    The notion of "unit testing" is about writing...

    The notion of "unit testing" is about writing tests that apply specifically to a small unit.

    As much as possible, your tests should be simple tests of functionality and should demonstrate how the...
  13. Replies
    5
    Views
    5,551

    A function pointer is used to provide a program...

    A function pointer is used to provide a program with a way to change the function that will be called without having to use control flow.

    It is possible to handle most (but not all) dispatch...
  14. Try Compiler Explorer (http://www.godbolt.org) --...

    Try Compiler Explorer -- Matt Godbolt's "Compiler Explorer" website. You can select a MIPS compiler, and choose which one you like best, then generate assembly from whatever C code you post up.
  15. No. The return address relates to the calling...

    No. The return address relates to the calling function, not the called function.

    If two different functions both called down to the same lower-level function, they wouldn't put the same address...
  16. Replies
    8
    Views
    3,461

    Just put the data in as initializers. ...

    Just put the data in as initializers.



    struct Node {
    struct Node *left;
    struct Node *right;
    char payload;
    };
  17. Replies
    5
    Views
    3,774

    @Salem's got it right. Also, in your insert...

    @Salem's got it right.

    Also, in your insert code you should consider just dropping the new entry at the front of the linked list:



    entry->next = lookup_table[i];


    That way it doesn't...
  18. Replies
    2
    Views
    3,251

    I don't know about the writing, but there are...

    I don't know about the writing, but there are pictures in this article that illustrate the two successful cases of realloc working: The realloc() Function in C - C Programming Tutorial - OverIQ.com
    ...
  19. You never initialize your both variable. It is an...

    You never initialize your both variable. It is an automatic variable, so it has a basically random value. You start writing to it, without ever pointing it at something.

    It's like visiting a...
  20. Replies
    6
    Views
    6,330

    Ironically, stdio is a *bad* example. The stdio...

    Ironically, stdio is a *bad* example. The stdio functions as a whole put the file pointer at the end of the argument list about half the time, and the front of the list the other half.



    ...
  21. Replies
    2
    Views
    3,776

    You are correct that using bool type will...

    You are correct that using bool type will generally lead to a savings in memory versus int.


    There are several things to consider. First, bool is a "new" type. It was not added to the original...
  22. Replies
    17
    Views
    11,731

    This macro is one of the most common utility...

    This macro is one of the most common utility macros in C programmers' toolboxes everywhere. Pretty much everybody needs it, and the standards committee has never bothered to help us out, because ......
  23. Replies
    7
    Views
    5,622

    I'm not seeing a function called convert that...

    I'm not seeing a function called convert that returns an int.
  24. Replies
    5
    Views
    6,595

    You mention being fluent in Pascal, and perhaps...

    You mention being fluent in Pascal, and perhaps that is where some of your style comes from. I have some suggestions unrelated to the actual subject of your question. Consider this snippet of your...
  25. Replies
    6
    Views
    3,545

    Here's a good link for you: C Operator Precedence...

    Here's a good link for you: C Operator Precedence - cppreference.com

    The cppreference website is obviously targeted at C++, but they have C pages for a huge set of relevant topics. Probably the...
Results 1 to 25 of 139
Page 1 of 6 1 2 3 4