scanf requires you to pass the address of the memory space you want to store the result in, unlike printf, which only requires the value (it couldn't care less where the value resides). To get the address of a variable in C, you use the & operator:
int a;
scanf("%d", &a);
Meaning: read an integer into the address I specified, in this case the address of a. The same goes for struct members, regardless of whether the struct itself resides on the stack or heap, accessed by pointer, etc:
struct some_struct* pointer = ........;
scanf("%d", &pointer->member);
And that would read an integer into the address of pointer plus the offset of member into the structure.
int, notfloatordouble?scanfexists as it usually buys more trouble than it saves by trying to do two tasks (input and parsing) and does both half-way.fgetsandsscanfsplits the task and makes parse errors far more easily handled.