- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hello! (Wave)
I have a question...
https://dyclassroom.com/c/c-passing-structure-pointer-to-function
At the Complete code stated at the site above, at this part:
why when the input is an array we do not use & and when the input is not array we use it?
So why we use only & before ptr->points?
Which is the difference? :unsure:
I have a question...
https://dyclassroom.com/c/c-passing-structure-pointer-to-function
At the Complete code stated at the site above, at this part:
Code:
for (i = 0; i < 3; i++) {
printf("Enter detail of student #%d\n", (i + 1));
printf("Enter ID: ");
scanf("%s", ptr->id);
printf("Enter first name: ");
scanf("%s", ptr->firstname);
printf("Enter last name: ");
scanf("%s", ptr->lastname);
printf("Enter Points: ");
scanf("%f", &ptr->points);
// update pointer to point at next element
// of the array std
ptr++;
}
So why we use only & before ptr->points?
Which is the difference? :unsure: