You have several issues with the code that appears.
-
%c
is for reading a caretere. To read a string you must use %s
- The declaration of a variable of type type
struct informacao_sobre_os_filme;
is left without the name of the variable.
- The structure should be declared before
main
as convention and so that it can be used by various functions.
Correcting all this would look like this:
struct informacao_sobre_os_filme {
int ano_de_lancamento, faixa_etaria;
double duracao;
char nacionalidade[200], nome_do_filme[200], genero[200];
};
int main(){
struct informacao_sobre_os_filme filme1; //agora variavel chamada filme1
printf("CADASTRMENTO DE FILMES: \n");
printf("Nome do filme: \n");
scanf("%s", filme1.nome_do_filme); //ler para o filme1 no campo nome_do_filme
return 0;
}
Note that since nome_do_filme
is an array of characters, it is already technically pointer to the first one, so it does not take &
to scanf
.
If you want you can even use a more robust form of reading that would be with fgets
. With fgets
can read more than one word and ensure that it does not read more than the space it allocated, which would in this case be 200
characters:
...
printf("Nome do filme: \n");
fgets(filme1.nome_do_filme, 200, stdin);
...