I'm trying to create an array of type struct but I'm having some trouble assigning and accessing data from it once I've created it. I have a basic understanding of what things do in C, but I'm still very new.
Here is my declaration of the struct and array:
typedef struct search{
char word[10];
};
struct search words[40];
The first time I need to use the array is when I need to store a string in the first element (from a command line argument). What is my mistake, syntactically and theoretically?
words[0] = *argv[count]; //It says I can't assign char to struct words
The next time I need to access it is inside a function. The first line is how I have called the function, and then I will post the function prototype and then the lines inside that are giving me trouble. Please let me know if I need to clarify that structure.
parseSearchWords(words); // function call
int parseSearchWords(struct search *word); // function prototype
word[0][0] = 'a';// THe lines giving me the errors
printf("%s\n", *word[0][0]);
Although I'm sure it's obvious what's wrong with the statement, the error is: subscripted value is neither array not pointer nor vector.
Thanks for the help, please let me know if I can clarify anything.