Update Q2.c

This commit is contained in:
2024-11-18 20:46:54 -08:00
parent e93dfac07a
commit f1b37bca68

9
Q2.c
View File

@@ -43,14 +43,15 @@ Product* insert_product(Product *head, int id, char *name, int quantity) {
return head; return head;
} }
void print_all_products(Product *head) { void print_products(Product *head) {
Product *temp = head; Product *temp = head;
while(temp != NULL) { while(temp != NULL) {
printf("Product ID: %d\n", temp->id); printf("Product id: %d\n", temp->id);
printf("Product Name: %s\n", temp->name); printf("Name: %s\n", temp->name);
printf("Product Quantity: %d\n\n", temp->quantity); printf("Quantity: %d\n\n", temp->quantity);
temp = temp->next; temp = temp->next;
} }
printf("\n");
} }
int main() { int main() {