Yes, when you write
scanf("%d", &ptr->value);
if the
scanf
function call succeed then
s.value
is changed.
No,
&ptr->value
is not equivalent to
ptr.value
.
As matter of fact,
ptr->value
is equivalent to
(*ptr).value
, hence you might write
&((*ptr).value)
instead of
&(ptr->value)
(outer brackets added for clarity).
Try
#include <stdio.h>
struct point
{
int value;
};
int main()
{
struct point pnt;
struct point * p = &pnt;
pnt.value = 0;
printf("%d\n", pnt.value);
p->value = 42;
printf("%d\n", pnt.value);
(*p).value = -273;
printf("%d\n", pnt.value);
scanf("%d", &(p->value));
printf("%d\n", pnt.value);
scanf("%d", &((*p).value));
printf("%d\n", pnt.value);
return 0;
}