I am trying to use scanf()
to input values to a structure using pointers.Can you help me to understand why my code is not working
This is my code:
#include<stdio.h>
struct student
{
int no;
float marks;
}st[2],*s;
main()
{
printf("enter the values");
for(s=st;s<st+2;s++)
{
scanf("%d%d",&s->no,&s->marks);
}
for(s=st;s<st+2;s++)
{
printff("%d\t%d\t",s->no,s->marks);
}
}
in this code scanf is not working properly,it is taking only the first value