3
I’m trying to create a kind of constructive data, but I’m having problems with the strings.
typedef struct {
char nome[30];
int idade;
} p;
p x,y;
x.nome = “ana”;
x.idade = 20;
y.nome = “caio”;
y.idade = 22;
printf(“%s : %d”, x.nome, x.idade);
printf(“%s : %d”, y.nome, y.idade);
Why can’t I do x.nome = “ana”;
?
Thanks! What would the code look like if it was a char pointer'?
– Paulo Dos Santos
The way you did, only the member would be
char *nome
– Maniero
@Paulodossantos more in detail in http://answall.com/q/181609/101.
– Maniero