You can't read user input in an un-initialized pointer. Instead, have a variable of the struct data type and assign its address to pointer before accessing its inner elements by → operator
example
#include <stdio.h>
struct example{
char name[20];
};
main(){
struct example *ptr;
struct example e;
puts("enter name");
gets(e.name);
ptr=&e;
puts(ptr->name);
}Output
Typical result of above code
enter name Disha You entered Disha