You can't create "struct item2 { char nome[]; };" because there is no size on the array. And you can't assign an array to an array like "item2.nome = nomes;" - you need to use something like strcpy(). So it would look like this: https://onlinegdb.com/JCd6_IV7X
#include <stdio.h>
#include <string.h>
struct item2
{
char nome[100];
};
typedef struct item2 Item2;
Item2 item2create(char nomes[])
{
Item2 item2;
strcpy(item2.nome,nomes);
return item2;
}
int main()
{
Item2 item = item2create("Hello World!");
printf("%s\n",item.nome);
return 0;
}