Hi all.
Can someone please explain why the compiler is giving this error? Why does the compiler think that there is no structure? Thanks in advance.
Code:
main.c||In function ‘main’:|
main.c|15|error: request for member ‘word’ in something not a structure or union|
||=== Build finished: 1 errors, 0 warnings ===|
Code:
#include <stdio.h>
struct word {
char word[40];
int x;
};
int main(void)
{
struct word word;
struct word *p_word;
p_word = &word;
p_word.word = 40 * mallaoc(sizeof(char));
return 0;
}
Same error for this.
Code:
#include <stdio.h>
struct word {
char word[40];
int x;
};
int main(void)
{
struct word *word;
word.word = mallaoc(sizeof(char));
return 0;
}