Hello All
I tried to write this code. A structure is declared in the main function. I tried to pass the structure as a function parameter into function test. But it doesn’t work.
I was hoping if someone can just see my code take about 2-3 mins of there time and tell me where I went wrong and correct this code.
Any help big or small will be highly appreciated.
Code:
#include <stdio.h>
typedef struct{
int number;
int place;
int postcode;
} information_t;
int test(information_t *in);
int main()
{
information_t information;
information *in;
printf(" Please enter the number: ");
scanf(" %d",&information.number);
printf(" Please enter the place: ");
scanf(" %d",&information.place);
printf(" please enter the postcode: ");
scanf(" %d",&information.postcode);
test(&information_t *in);
return 0;
}
int test(information_t *in)
{
int position;
position= scanf(" %d%d%d", &in->number, &in->place, &in->postcode);
return(position);
}