added print function

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

View File

@ -1,5 +1,6 @@
#include <string.h>
#include "GildedRose.h"
#include <stdio.h>
Item*
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;
}
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;

View File

@ -1,3 +1,6 @@
#ifndef ROSE_INCLUDED
#define ROSE_INCLUDED
typedef struct
{
char *name;
@ -7,3 +10,6 @@ typedef struct
extern Item* init_item(Item* item, const char *name, int sellIn, int quality);
extern void update_quality(Item items[], int size);
extern char* print_item(char* buffer, Item* item);
#endif