/*To Display the name of book,pages and price using pointer to structure*/ #include void main() { struct book { char name[10]; float price ; int pages; }b; struct book *p; p=&b; printf("\n\t Enter name of Book"); scanf("%s",p->name); printf("\n\tEnter price of Book"); scanf("%f",&p->price); printf("\n\tEnter pages of Book"); scanf("%d",&p->pages); printf("\n\tBook name=%s \n\tBook price=%f \n\tBook pages=%d",p->name,p->price,p->pages); }
/*To Display the name of book,pages and price using pointer to structure*/ #include void main() { struct book { char name[10]; float price ; int pages; }b; struct book *p; p=&b; printf("\n\t Enter name of Book"); scanf("%s",p->name); printf("\n\tEnter price of Book"); scanf("%f",&p->price); printf("\n\tEnter pages of Book"); scanf("%d",&p->pages); printf("\n\tBook name=%s \n\tBook price=%f \n\tBook pages=%d",p->name,p->price,p->pages); }
/*display n,s,id using pointer to structure*/ #include void main() { struct emp { char name[10]; float salary; int id; }e; struct emp *p; p=&e; printf("\n\t enter name of emp"); scanf("%s",p->name); printf("\n\t enter salary of emp"); scanf("%f",&p->salary); printf("\n\t enter id of emp"); scanf("%d",&p->id); printf("\n\tname=%s \n\tsalary=%f \n\tid=%d",p->name,p->salary,p->id); }
/*display n,s,id using pointer to structure*/ #include void main() { struct emp { char name[10]; float salary; int id; }e; struct emp *p; p=&e; printf("\n\t enter name of emp"); scanf("%s",p->name); printf("\n\t enter salary of emp"); scanf("%f",&p->salary); printf("\n\t enter id of emp"); scanf("%d",&p->id); printf("\n\tname=%s \n\tsalary=%f \n\tid=%d",p->name,p->salary,p->id); }
/*To Display the name of book,pages and price using pointer to structure*/ #include void main() { struct book { char name[10]; float price ; int pages; }b; struct book *p; p=&b; printf("\n\t Enter name of Book"); scanf("%s",p->name); printf("\n\tEnter price of Book"); scanf("%f",&p->price); printf("\n\tEnter pages of Book"); scanf("%d",&p->pages); printf("\n\tBook name=%s \n\tBook price=%f \n\tBook pages=%d",p->name,p->price,p->pages); }
int pages; char name[10]; float price; }b; struct book *p; p=&b;
printf("\n\t Enter the pages of book=="); scanf("%d",&p->pages); printf("\n\t Enter the name of book=="); scanf("%s",p->name); printf("\n\t Enter the price of book=="); scanf("%f",&p->price);
printf("\n\t pages of book=%d ,name ofbook=%s,priceofbook =%f",p->pages,p->name,p->price);
/*pointer to structure of employee*/ #include void main() {
struct employee {
char name[10]; float salary; int id; int mno; }b;
struct employee*p; p=&b;
printf("\n\t enter name"); scanf("%s",p->name); printf("\n\t enter salary" ); scanf("%f",&p->salary); printf("\n\t enter id"); scanf("%d",&p->id); printf("\n\t enter mno"); scanf("%d",&p->mno);
/* pointer to structure */ #include void main() { struct book { char name[20]; float price; int pages; }b;
struct book *p1; p1=&b; printf("\n enter name of book"); scanf("%s",p1->name); printf("\n enter price of book"); scanf("%f",&p1->price); printf("\n enter pages of book" ); scanf("%d",&p1->pages); printf("\n name of book=%s \n price of book=%f \n pages of book=%d ",p1->name,p1->price,p1->pages); }
#include void main() { struct book { int pg; int price; char name[20]; }; struct book *ptr,p; ptr=&p; //referencing pointer to memory address
printf("\n\tEnter the pages:"); scanf("%d",&ptr->pg); //fflush(0); printf("\n\tEnter the price:"); scanf("%d",&ptr->price); //fflush(0); printf("\n\tEnter name of book:"); scanf("%s",&ptr->name); printf("\n\tBook details are:\n\t1.Name:%s \n\t2.Number of pages:%d \n\t3.price of book:%d ",ptr->name,ptr->pg,ptr->price); }
/*Info of book*/ #include void main() { struct book { char name[20]; float price; int pages; }b; struct book *p; p=&b; printf("\n\t enter name of book"); scanf("%s",p->name); printf("\n\t enter price of book"); scanf("%f",&p->price); printf("\n\t enter pages of book"); scanf("%d",&p->pages);
/*To Display the name of book,pages and price using pointer to structure*/ #include void main() { struct book { char name[10]; float price ; int pages; }b; struct book *p; p=&b; printf("\n\t Enter name of Book"); scanf("%s",p->name); printf("\n\tEnter price of Book"); scanf("%f",&p->price); printf("\n\tEnter pages of Book"); scanf("%d",&p->pages); printf("\n\tBook name=%s \n\tBook price=%f \n\tBook pages=%d",p->name,p->price,p->pages); }
/*To Display the name of book,pages and price using pointer to structure*/
ReplyDelete#include
void main()
{
struct book
{
char name[10];
float price ;
int pages;
}b;
struct book *p;
p=&b;
printf("\n\t Enter name of Book");
scanf("%s",p->name);
printf("\n\tEnter price of Book");
scanf("%f",&p->price);
printf("\n\tEnter pages of Book");
scanf("%d",&p->pages);
printf("\n\tBook name=%s \n\tBook price=%f \n\tBook pages=%d",p->name,p->price,p->pages);
}
/*To Display the name of book,pages and price using pointer to structure*/
ReplyDelete#include
void main()
{
struct book
{
char name[10];
float price ;
int pages;
}b;
struct book *p;
p=&b;
printf("\n\t Enter name of Book");
scanf("%s",p->name);
printf("\n\tEnter price of Book");
scanf("%f",&p->price);
printf("\n\tEnter pages of Book");
scanf("%d",&p->pages);
printf("\n\tBook name=%s \n\tBook price=%f \n\tBook pages=%d",p->name,p->price,p->pages);
}
/*display n,s,id using pointer to structure*/
ReplyDelete#include
void main()
{
struct emp
{
char name[10];
float salary;
int id;
}e;
struct emp *p;
p=&e;
printf("\n\t enter name of emp");
scanf("%s",p->name);
printf("\n\t enter salary of emp");
scanf("%f",&p->salary);
printf("\n\t enter id of emp");
scanf("%d",&p->id);
printf("\n\tname=%s \n\tsalary=%f \n\tid=%d",p->name,p->salary,p->id);
}
/*display n,s,id using pointer to structure*/
Delete#include
void main()
{
struct emp
{
char name[10];
float salary;
int id;
}e;
struct emp *p;
p=&e;
printf("\n\t enter name of emp");
scanf("%s",p->name);
printf("\n\t enter salary of emp");
scanf("%f",&p->salary);
printf("\n\t enter id of emp");
scanf("%d",&p->id);
printf("\n\tname=%s \n\tsalary=%f \n\tid=%d",p->name,p->salary,p->id);
}
/*To Display the name of book,pages and price using pointer to structure*/
ReplyDelete#include
void main()
{
struct book
{
char name[10];
float price ;
int pages;
}b;
struct book *p;
p=&b;
printf("\n\t Enter name of Book");
scanf("%s",p->name);
printf("\n\tEnter price of Book");
scanf("%f",&p->price);
printf("\n\tEnter pages of Book");
scanf("%d",&p->pages);
printf("\n\tBook name=%s \n\tBook price=%f \n\tBook pages=%d",p->name,p->price,p->pages);
}
#include
ReplyDelete#include
void main()
{
struct book
{
int pages;
char name[10];
float price;
}b;
struct book *p;
p=&b;
printf("\n\t Enter the pages of book==");
scanf("%d",&p->pages);
printf("\n\t Enter the name of book==");
scanf("%s",p->name);
printf("\n\t Enter the price of book==");
scanf("%f",&p->price);
printf("\n\t pages of book=%d ,name ofbook=%s,priceofbook =%f",p->pages,p->name,p->price);
}
/*pointer to structure of employee*/
ReplyDelete#include
void main()
{
struct employee
{
char name[10];
float salary;
int id;
int mno;
}b;
struct employee*p;
p=&b;
printf("\n\t enter name");
scanf("%s",p->name);
printf("\n\t enter salary" );
scanf("%f",&p->salary);
printf("\n\t enter id");
scanf("%d",&p->id);
printf("\n\t enter mno");
scanf("%d",&p->mno);
printf("name=%s,salary=%f,id=%d,mno=%d",p->name,p->salary,p->id,p->mno);
}
/* pointer to structure */
ReplyDelete#include
void main()
{
struct book
{
char name[20];
float price;
int pages;
}b;
struct book *p1;
p1=&b;
printf("\n enter name of book");
scanf("%s",p1->name);
printf("\n enter price of book");
scanf("%f",&p1->price);
printf("\n enter pages of book" );
scanf("%d",&p1->pages);
printf("\n name of book=%s \n price of book=%f \n pages of book=%d ",p1->name,p1->price,p1->pages);
}
#include
ReplyDeletevoid main()
{
struct book
{
int pg;
int price;
char name[20];
};
struct book *ptr,p;
ptr=&p; //referencing pointer to memory address
printf("\n\tEnter the pages:");
scanf("%d",&ptr->pg);
//fflush(0);
printf("\n\tEnter the price:");
scanf("%d",&ptr->price);
//fflush(0);
printf("\n\tEnter name of book:");
scanf("%s",&ptr->name);
printf("\n\tBook details are:\n\t1.Name:%s \n\t2.Number of pages:%d \n\t3.price of book:%d ",ptr->name,ptr->pg,ptr->price);
}
/*Info of book*/
ReplyDelete#include
void main()
{
struct book
{
char name[20];
float price;
int pages;
}b;
struct book *p;
p=&b;
printf("\n\t enter name of book");
scanf("%s",p->name);
printf("\n\t enter price of book");
scanf("%f",&p->price);
printf("\n\t enter pages of book");
scanf("%d",&p->pages);
printf("\n\t name=%s,price=%f,pages=%d",p->name,p->price,p->pages);
}
/*To Display the name of book,pages and price using pointer to structure*/
ReplyDelete#include
void main()
{
struct book
{
char name[10];
float price ;
int pages;
}b;
struct book *p;
p=&b;
printf("\n\t Enter name of Book");
scanf("%s",p->name);
printf("\n\tEnter price of Book");
scanf("%f",&p->price);
printf("\n\tEnter pages of Book");
scanf("%d",&p->pages);
printf("\n\tBook name=%s \n\tBook price=%f \n\tBook pages=%d",p->name,p->price,p->pages);
}