Search:

Type: Posts; User: TheMuffenMann

Search: Search took 0.00 seconds.

  1. Replies
    14
    Views
    11,594

    That seems about right. I usually put my typedefs...

    That seems about right. I usually put my typedefs just above the structures themselves unless the structure itself is a typedef.

    I suppose everyone has different taste. Although I also put the...
  2. Dynamic memory is allocated on the heap with the...

    Dynamic memory is allocated on the heap with the malloc() family of functions. In contrast, function calls push their local variables to the stack. Heap memory persists until you free it. You would...
  3. Replies
    8
    Views
    2,615

    void (*fun_ptr)(void) = &colour; You can...

    void (*fun_ptr)(void) = &colour;


    You can leave off the & when assigning the colour function to the pointer. In C, a function name is a pointer to the function's code.
  4. This may not be accurate, but my understanding is...

    This may not be accurate, but my understanding is that marking a global variable in a source file as static means that while the variable is indeed global, it's global only to the functions in that...
  5. Replies
    4
    Views
    4,298

    I tried to edit the previous post but it seems I...

    I tried to edit the previous post but it seems I cant.

    Thanks, I think I get what you're saying.

    I made some changes and although the stack still holds elements of a Stack_Element type, that...
  6. Replies
    4
    Views
    4,298

    Ok, thanks for the feedback. I see what you...

    Ok, thanks for the feedback.

    I see what you mean with stack_peek() I think at the time the thinking was if you peeked an item and then popped one off the stack you'd lose access to that item but...
  7. Replies
    4
    Views
    4,298

    General Stack Implementation

    Hey all,

    I’ve implemented a general stack data type and am posting the source code here in the hope that others may find it useful.

    The stack:

    1. Can hold objects of any type.
    2. Can grow...
Results 1 to 7 of 7