What I am trying to do is create an array of structs, and initialize it through a function however I am getting a few errors,
lab2.c:20:2: error: declaration of anonymous struct must be a definition struct *person users[] = userInput(); ^ lab2.c:20:2: warning: declaration does not declare anything[-Wmissing-declarations] struct *person users[] = userInput(); ^~~~~~ lab2.c:24:1: error: declaration of anonymous struct must be a definition struct * userInput() { ^ lab2.c:48:2: error: expected identifier or '(' } ^ 1 warning and 3 errors generated. Below is my code, in condensed version, if more is needed let me know, I'm pretty new to C so I'm guessing this is an obvious mistake on my part.
int main() { struct person users = userInput(); return 0; } struct * userInput() { struct person users[30]; ...do stuff to struct here... return *users; }
struct*isn't a data type.