File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <string.h>
3
+
4
+ struct Books {
5
+ char title[50];
6
+ char author[50];
7
+ char subject[100];
8
+ int book_id;
9
+ };
10
+
11
+ /* function declaration */
12
+ void printBook( struct Books book );
13
+
14
+ int main( ) {
15
+
16
+ struct Books Book1; /* Declare Book1 of type Book */
17
+ struct Books Book2; /* Declare Book2 of type Book */
18
+
19
+ /* book 1 specification */
20
+ strcpy( Book1.title, "C Programming");
21
+ strcpy( Book1.author, "Nuha Ali");
22
+ strcpy( Book1.subject, "C Programming Tutorial");
23
+ Book1.book_id = 6495407;
24
+
25
+ /* book 2 specification */
26
+ strcpy( Book2.title, "Telecom Billing");
27
+ strcpy( Book2.author, "Zara Ali");
28
+ strcpy( Book2.subject, "Telecom Billing Tutorial");
29
+ Book2.book_id = 6495700;
30
+
31
+ /* print Book1 info */
32
+ printBook( Book1 );
33
+
34
+ /* Print Book2 info */
35
+ printBook( Book2 );
36
+
37
+ return 0;
38
+ }
39
+
40
+ void printBook( struct Books book ) {
41
+
42
+ printf( "Book title : %s\n", book.title);
43
+ printf( "Book author : %s\n", book.author);
44
+ printf( "Book subject : %s\n", book.subject);
45
+ printf( "Book book_id : %d\n", book.book_id);
46
+ }
You can’t perform that action at this time.
0 commit comments