When I tried to use only INT arguments, it worked perfectly, but when I try to use strings I always get "Segmentation Fault" and I don't know why. I know it might be a silly mistake, but would anyone care to explain it to me, please?
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct cliente{
char *nome;
int idade;
}t_cliente;
int main(){
t_cliente *vet;
int qtdCliente, i, j;
scanf("%d", &qtdCliente);
vet=(t_cliente*)malloc(qtdCliente*sizeof(t_cliente));
for(i=0; i<qtdCliente; i++){
scanf("%s", vet[i].nome);
scanf("%d", &vet[i].idade);
}
for(j=0; j<qtdCliente; j++){
printf("%s\n", vet[j].nome);
printf("%d\n", vet[j].idade);
printf("\n");
}
free(vet);
return 0;
}