./drzwoposzukiwanbinarnych.c:84:24: error: expected expression before â)â token
char getNewSlowo(){
slowa *wyraz = (wyraz*) malloc(sizeof(slowa)); //LINE WITH ERROR
scanf("%s",wyraz->slowo);
return wyraz->slowo;
}
What I am trying to do?
So, I have a struct:
typedef struct node{
char *word;
unsigned int arity;
struct node *left,*right,*parent;
}baza;
I want to make that pointer word is pointing to - char slowo[30] defined below.
typedef struct word{
char slowo[30];
}slowa;
And the point that I am stuck on is the error on the top of this question. I am extremely tired of coding and my mind is completely overheated right now so my question may be not well formed for what I am sorry if that's the case.
But why I am trying to do this? I had a problem with assigning a word defined globally to the pointer and I noticed that when I read a new word into that global defined word the word in the struct (pointer) changed also.