私は持っている:
#include <stdio.h>
struct DVD {
char *movie_title;
int minutes;
float price;
};
void display_struct(struct DVD *ptr);
int
main()
{
struct DVD movies[10];
movies[0].movie_title = "I Am Legend"; //Don't want to do this
}
void
display_struct(struct DVD *ptr)
{
printf("%s\n%i\n%f\n", ptr->movie_title, ptr->minutes, ptr->price);
}
1 つのステートメントで、構造体の配列に 10 個の映画のタイトルを割り当てたいと考えています。これは可能ですか?ありがとう!