I was trying to send a structure to a function and fill out the structure with the right value in the function and then display the value in main, but it was not is not working when i run it.(i cant use pointer functions).
struct inventory{
char name[20];
int number;
};
void function(struct inventory items);
int main()
{
int x,y,z;
struct inventory items;
function(items);
printf("\nam in main\n");
printf("\n%s\t",(items).name);
printf(" %i\t",(items).number);
getch();
}
void function(struct inventory items)
{
printf(" enter the item name\n ");
scanf(" %s ",&(items).name );
printf(" enter the number of items\n ");
scanf("%i",&(items).number );
}
(ie: i am not allowed to use pointer function ) how can i display the name and the number without pointer.