40 lines
774 B
C
40 lines
774 B
C
|
#include <stdio.h>
|
||
|
|
||
|
typedef struct {
|
||
|
char *titel;
|
||
|
char *autor;
|
||
|
int erscheinungsjahr;
|
||
|
char *isbn;
|
||
|
} book_t;
|
||
|
|
||
|
void print_book(book_t *book) {
|
||
|
printf("Titel: %s\n", book->titel);
|
||
|
printf("Autor: %s\n", book->autor);
|
||
|
printf("Erscheinungsjahr: %d\n", book->erscheinungsjahr);
|
||
|
printf("ISBN: %s\n", book->isbn);
|
||
|
printf("\n");
|
||
|
}
|
||
|
|
||
|
int main(int argc, char** argv) {
|
||
|
book_t books[] = {
|
||
|
{
|
||
|
"Harry Potter und der Stein der Weisen",
|
||
|
"J.K. Rowling",
|
||
|
1997,
|
||
|
"978-3551354013"
|
||
|
},
|
||
|
{
|
||
|
"Der Herr der Ringe",
|
||
|
"J.R.R. Tolkien",
|
||
|
1954,
|
||
|
"978-3608939842"
|
||
|
} };
|
||
|
|
||
|
for (int i = 0; i < 2; i++) {
|
||
|
printf("Buch %d\n", i + 1);
|
||
|
print_book(&books[i]);
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|