//Passing Struct To function
#include<stdio.h>
#include<conio.h>
struct book
{
char n[20];
int nop;
float pr;
};
void main()
{
struct book b={"Basic",425,135.00}; //value to structures
clrscr();
display(b);
show(&b);
getche();
}
display(struct book bb)
{
printf("\n%s\t%d\t%.2f",bb.n,bb.nop,bb.pr);
return 0;
}
show(struct book *bb)
{
printf("\n%s\t%d\t%.2f",(*bb).n,(*bb).nop,(*bb).pr);
printf("\n%s\t%d\t%.2f",bb->n,bb->nop,bb->pr);
return 0;
}
No comments:
Post a Comment