added print function

This commit is contained in:
emily committed 2021-10-12 08:14:19 +02:00
1 parent 241fab2462
commit 25a3d10aa3
2 files changed
+15 -1

No files matched your search

+9 -1
View File
@@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include "GildedRose.h" #include "GildedRose.h"
#include <stdio.h>
Item* Item*
init_item(Item* item, const char *name, int sellIn, int quality) init_item(Item* item, const char *name, int sellIn, int quality)
@@ -11,7 +12,14 @@ init_item(Item* item, const char *name, int sellIn, int quality)
return item; return item;
} }
void update_quality(Item items[], int size) extern char*
print_item(char* buffer, Item* item)
{
sprintf(buffer, "%s, %d, %d", item->name, item->sellIn, item->quality);
}
void
update_quality(Item items[], int size)
{ {
int i; int i;
+6
View File
@@ -1,3 +1,6 @@
#ifndef ROSE_INCLUDED
#define ROSE_INCLUDED
typedef struct typedef struct
{ {
char *name; char *name;
@@ -7,3 +10,6 @@ typedef struct
extern Item* init_item(Item* item, const char *name, int sellIn, int quality); extern Item* init_item(Item* item, const char *name, int sellIn, int quality);
extern void update_quality(Item items[], int size); extern void update_quality(Item items[], int size);
extern char* print_item(char* buffer, Item* item);
#endif