When using scanf:
For integers: scanf(“%d”,& variablename);
For characters: scanf(“%c”, & variablename);
For floats: scanf(“%f”,& variablename);
For strings: scanf(“%s”, variablename);
NOTES:
- Don’t use ‘&’ when storing strings.
- Don’t use “%.2f” when scanning in a float as this will lose some accuracy of the value. It should only be used with printf for rounding a number to the required decimal place.