Struct Movie

PHOTO EMBED

Mon Jun 10 2024 12:15:06 GMT+0000 (Coordinated Universal Time)

Saved by @meanaspotato #c #enum #struct

#include <stdio.h>

struct Movie
{
    char title [50];
    int minutes;
    float tomatometer;
};

void print_movie(struct Movie a_super_hero);

int main(void)
{
    struct Movie movie;

	sprintf(movie.title, "Batman Returns");
	movie.minutes = 126;
	movie.tomatometer = 0.81f;

	print_movie(movie);
	
	return 0;
}

void print_movie(struct Movie a_movie)
{
    printf("Movie title:        %s\n",a_movie.title);
    printf("Runtime in minutes: %d\n",a_movie.minutes);
    printf("Tomatometer Score:  %.2f",a_movie.tomatometer);
}
content_copyCOPY

Movie title: Batman Returns Runtime in minutes: 126 Tomatometer Score: 0.81