I have a small problem with this program I'm writing, I'm trying to input data into a structure using a pointer but the compiler just gives me an error stating: "dereferencing pointer to incomplete type"
the function of the program is simple: a program that uses functions to input data into a structure using pointers
heres the code: the main function simply calls the input function and passes the structure pointer as an argument
void input(struct test *ptr)
{
printf("Enter: \n");
fflush(stdin);
scanf("%s",&ptr->entry);
}
void print(struct test *ptr)
{
}
int main()
{
int counter;
struct test
{
char entry[20];
}p[4];
struct test *ptr=p;
ptr=&p;
for(counter=0;counter<=4;counter++)
{
input(ptr);
ptr++;
}
return 1;
}
The print function is still empty.