Create a Book structure containing book_id, title, author name and price. Write a C program to pass a structure as a function argument and print the book details.

Program Code:
#include<stdio.h>
#include<string.h>
struct book
{
intbookid;
char title[30];
char author[20];
float price;
};
voidprint_book(struct book b1);
void main()
{
struct book b1;
printf("\n enter book details: ");
scanf("%d%s%s%f",&b1.bookid,b1.title,b1.author,&b1.price);
print_book(b1);
}
voidprint_book(struct book b1)
{
printf("\n book details:%d\t %s\t %s\t %f",b1.bookid,b1.title,b1.author,b1.price);
}
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: