I bet you've all been asked this a million times but here goes! :)
I'm coding an English language dictionary which is stored in a tree by way of the following structure:
Expand|Select|Wrap|Line Numbers
- #define MAXWORDSIZE 100
- typedef char word[MAXWORDSIZE];
- typedef struct dictionary *dict;
- struct dictionary {
- dict left,right;
- word theword;
- } ;
Expand|Select|Wrap|Line Numbers
- strcpy(d->theword, w);
I have attempted to do this using the following code on the line above the 'strcpy' line:
Expand|Select|Wrap|Line Numbers
- d->theword = (char *) malloc(sizeof(d->theword[MAXWORDSIZE]));
Expand|Select|Wrap|Line Numbers
- error: incompatible types in assigment
Thanks in advance,
P