The corner shop is down to 2 cartons of milk, and restock(&milk, 10) adds 10. The function gets item, the address of milk; add more to its qty through it.
milk: 12
#include <stdio.h>
struct Item {
char name[20];
int qty;
};
void restock(struct Item *item, int more) {
// your code here: add more to item->qty
}
int main(void) {
struct Item milk = {"milk", 2};
restock(&milk, 10);
printf("%s: %d\n", milk.name, milk.qty);
return 0;
}
Run tries the examples. When they look right, Submit.