Oh ok. That solved it. Thanks Bayint.
Type: Posts; User: chris.r
Oh ok. That solved it. Thanks Bayint.
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
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.
...
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"...
Then there's also this container...
struct _Container *CreateContainer(char *name)
{
struct _Container *g = (struct _Container*)malloc(sizeof(struct _Container));
strcpy((char*)&g->Name,...
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...
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) { }...
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...
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...
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...
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...
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.
nope. you need to explicitly call free() on every thing you malloc.
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...
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;
};