You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
466 B
C
26 lines
466 B
C
/*Structure as Return type of a function*/
|
|
#include<stdio.h>
|
|
struct book
|
|
{
|
|
int id;
|
|
char name[40];
|
|
};
|
|
struct book getdata()
|
|
{
|
|
struct book b;
|
|
printf("Enter book name and id");
|
|
scanf("%s%d",&b.name,&b.id);
|
|
return b;
|
|
}
|
|
void display(struct book b)
|
|
{
|
|
printf("\nDetails are:\n");
|
|
printf("Book id = %d\n",b.id);
|
|
printf("Book name= %s",b.name);
|
|
}
|
|
void main()
|
|
{
|
|
struct book b;
|
|
b=getdata();
|
|
display(b);
|
|
} |