import std.stdio; struct Books { char [] title; char [] author; char [] subject; int book_id; }; void main( ) { Books Book1; /* Declare Book1 of type Book */ Books Book2; /* Declare Book2 of type Book */ /* book 1 specification */ Book1.title = "D Programming".dup; Book1.author = "Raj".dup; Book1.subject = "D Programming Tutorial".dup; Book1.book_id = 6495407; /* book 2 specification */ Book2.title = "D Programming".dup; Book2.author = "Raj".dup; Book2.subject = "D Programming Tutorial".dup; Book2.book_id = 6495700; /* print Book1 info */ printBook( Book1 ); /* Print Book2 info */ printBook( Book2 ); } void printBook( Books book ) { writeln( "Book title : ", book.title); writeln( "Book author : ", book.author); writeln( "Book subject : ", book.subject); writeln( "Book book_id : ", book.book_id); }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more