Search:

Type: Posts; User: chris.r

Search: Search took 0.00 seconds.

  1. Replies
    5
    Views
    1,609

    Oh ok. That solved it. Thanks Bayint.

    Oh ok. That solved it. Thanks Bayint.
  2. Replies
    5
    Views
    1,609

    Yeah but isn't that what I have? ...

    Yeah but isn't that what I have?



    p[0]+sizeof(int) == p[1] // true?

    // so shouldn't this be true?
    tbl = (Item**)malloc(sizeof(long)*10);
    /*
    That should be the same as
  3. Replies
    5
    Views
    1,609

    Memory management

    So I'm trying to figure out if I'm dealing with memory correctly by printing out pointer values...I can't find gdb for windows...yes, tried mingw but there was no gdb.exe in it.


    ...
  4. Replies
    13
    Views
    2,179

    What do you mean by the implementation? I'm...

    What do you mean by the implementation?

    I'm currently defining my structures like this: typedef struct _Name {} Name;
    My plan for using these structures outside the library was to use the "Name"...
  5. Replies
    13
    Views
    2,179

    Then there's also this container... struct...

    Then there's also this container...


    struct _Container *CreateContainer(char *name)
    {
    struct _Container *g = (struct _Container*)malloc(sizeof(struct _Container));
    strcpy((char*)&g->Name,...
  6. Replies
    13
    Views
    2,179

    Is there a limit to how much memory you can...

    Is there a limit to how much memory you can allocate?
    I'd rather not post the code if I don't have to. There's quite a bit of it relating to allocating memory...

    *edit*
    On the other hand, I...
  7. Replies
    7
    Views
    1,530

    One of my professors taught me a trick that will...

    One of my professors taught me a trick that will save you MANY MANY headaches developing data structures.
    The FIRST thing you should do is map out the special cases in your code:


    if (a) { }...
  8. Replies
    2
    Views
    1,548

    There are a LOT of implementations of strings in...

    There are a LOT of implementations of strings in c++. The best way to think of a character is a single point in memory that has a character in it, like 'A'.
    When strings are implemented in c (or...
  9. Replies
    13
    Views
    2,179

    Two Pointer Questions

    I have a C application that uses malloc and free to allocate and free memory. Yes..old fashioned, regular c, using the gcc compiler.
    I have a function that creates a structure in memory using malloc...
  10. Thread: Memory Layout

    by chris.r
    Replies
    5
    Views
    2,228

    Yes, I'm trying to create code that provides...

    Yes, I'm trying to create code that provides error information so I can deal with it in calling functions.
    I suppose this method isn't very expandable. I suppose the best way to deal with this would...
  11. Thread: Memory Layout

    by chris.r
    Replies
    5
    Views
    2,228

    Memory Layout

    I should probably know this, but...
    I'm writing a series of functions that return pointers to objects. In the case that an error occurs I am returning a hex value instead of a pointer.
    My return...
  12. Replies
    7
    Views
    1,091

    haha yeah i sorta realized it was easier than i...

    haha yeah i sorta realized it was easier than i thought..
    free( (*n).value );

    but that's what i get for coding at 3:30 in the morning.
  13. Replies
    7
    Views
    1,091

    nope. you need to explicitly call free() on every...

    nope. you need to explicitly call free() on every thing you malloc.
  14. Replies
    6
    Views
    1,656

    If I understand correctly, you just want an array...

    If I understand correctly, you just want an array of strings:
    [sub1,sub2,sub3]
    You'd essentially have a dynamic 2-d array like this:

    int numSubjects=10; // read this in
    char **subjects;

    then...
  15. Replies
    7
    Views
    1,091

    destroying a structue

    I'm trying to write a linked list with structures using gcc. I have a node structure:



    struct Node
    {
    void *value;
    Node *next;
    Node *prev;
    };
Results 1 to 15 of 15