#include <stdio.h>
struct SoftDrink
{
char name[17];
int size;
int energy;
float caffeine;
int intake;
};
void print_soft_drink(struct SoftDrink* drink);
int main(void)
{
struct SoftDrink drink = { "Life Modulus",250,529,80.50,500};
print_soft_drink(&drink);
return 0;
}
void print_soft_drink(struct SoftDrink *drink)
{
printf("A soft drink...\n\n");
printf("Name: %s\n",drink->name);
printf("Serving size: %d mL\n",drink->size);
printf("Energy content: %d kJ\n",drink->energy);
printf("Caffeine content: %f mg\n",drink->caffeine);
printf("Maximum daily intake: %d mL\n",drink->intake);
}
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