Here's some compilable code based on yours. I have no idea if it reflects what you're actually doing, but hopefully it will help you understand better.
The first call to malloc is in main(). This creates the room for the word "123456789".
The call to malloc() within the addidfword() function is there to create room for the structure of type IDFWORDS. I'm not sure what you're doing with these things, so it's difficult to judge if you're actually going the best way about things.
Anyway, see how you get on.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct
{
char *word;
} IDFWORDS;
void addidfword(char *word, char *dname, IDFWORDS *C)
{
IDFWORDS *new;
IDFWORDS *ptr;
/*
* This was: new=(IDFWORDS *)malloc(sizeof(IDFWORDS));
*/
new = malloc(sizeof(*new));
if (new)
{
new->word = word;
}
/*
* Continue to use new
* ...
*/
free(new);
}
int main(void)
{
char *p;
IDFWORDS c;
p = malloc(10);
if (p)
{
strcpy(p, "123456789");
addidfword(p, "dnameblurb", &c);
}
free(p);
return(0);
}