#include <stdio.h>
struct Softdrink
{
char name [16];
int size;
int energy;
float caffeine;
int max_daily;
};
void print_soft_drink(struct Softdrink a_soft_drink);
int main(void)
{
struct Softdrink life_mod;
sprintf(life_mod.name, "Life Modulus");
life_mod.size = 250;
life_mod.energy = 529;
life_mod.caffeine = 80.5f;
life_mod.max_daily = 500;
print_soft_drink(life_mod);
return 0;
}
void print_soft_drink(struct Softdrink a_soft_drink)
{
printf("A soft drink...\n\n");
printf("Name: %s\n",a_soft_drink.name);
printf("Serving size: %d mL\n",a_soft_drink.size);
printf("Energy content: %d kJ\n",a_soft_drink.energy);
printf("Caffeine content: %f mg\n",a_soft_drink.caffeine);
printf("Maximum daily intake: %d mL\n",a_soft_drink.max_daily);
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter