facing problem to copy string to a structure via function.can input the name but just cant copy it.can anyone help
#include<stdio.h>
#include<stdlib.h>
char copy(char *);//declare prototpe;
typedef struct{
char student_name[20];
int count;
}student_data;
student_data *p;// declare structure variable;
student_data s;//declare structure variable;
int main()
{
p=&s;//give p the address of s;
p->count=0; //give p->count value 0;
char name[20];
gets(name);
copy(name);
getch();
}
char copy(char *q)
{
strcpy( p->student_name[(p->count)++],q);
printf("%s",p->student_name);
}