#include void main() { struct book { char name[50]; float price; int page; }b;
struct book *p; p=&b; printf("\nEnter a name of book:\n"); scanf("%s",p->name); printf("\nEnter a price of book:\n"); scanf("%f",&p->price); printf("\nEnter a pages of book:\n"); scanf("%d",&p->page);
printf("\nName of book=%s\nPrice of book=%f\nPages of book=%d",p->name,p->price,p->page);
#include void main() { struct Book { char name[10]; float price; int pages; }b; struct Book *ptr printf("\n\tEnter Name of Book\n\t"); scanf("%s",b->name); printf("\n\tEnter price of Book\n\t"); scanf("%f",&b->price); printf("\n\tEnter Pages of Book\n\t"); scanf("%d",&b->pages);
#include void main() { struct book { char name[50]; float price; int page; }b;
struct book *p; p=&b; printf("\nEnter a name of book:\n"); scanf("%s",p->name); printf("\nEnter a price of book:\n"); scanf("%f",&p->price); printf("\nEnter a pages of book:\n"); scanf("%d",&p->page);
printf("\nName of book=%s\nPrice of book=%f\nPages of book=%d",p->name,p->price,p->page);
#include void main() { struct book { char name[10]; float price; int pages;
}b; struct book *p; p=&b; printf("\n\tEnter the book name"); scanf("%s",p->name); printf("\n\tEnter the price name"); scanf("%f",&p->price); printf("\n\tEnter the pages name"); scanf("%d",&p->pages);
#include void main() { struct Book { char name[20]; float price; int pages; }b; struct Book *ptr; ptr=&b; printf("\nEnter the name ,price,pages of book\n"); scanf("%s%f%d",ptr->name,&ptr->price,&ptr->pages); printf("\nName=%s \nPricse=%f \nPages=%d\n",ptr->name,ptr->price,ptr->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); }
only here lies a correct propgram!!Check it out!! #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); }
/*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); }
/* using pointer to structure */ #include void main() { struct book { char name[10]; float price; int pages; }b; struct book *p; printf("Enter the name of book"); scanf("%s",p->name); printf("\n\t enter price"); scanf("%f",&p->price); printf("\n\t enter pages"); scanf("%d",&p->pages); printf("\n\t name=%s\n\tprice=%f\n\tpages=%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); }
#include void main() { struct book { char name[20]; float price; int pages; }b; struct book *k; k=&b; printf("\n Book name="); scanf("%s",k->name); printf("\n Price="); scanf("%f",&k->price); printf("\n Enter no of pages="); scanf("%d",&k->pages); printf(" \n Name of book=%s \t Price of book=%f \tPages in book=%d \n",k->name,k->price,k->pages); }
/*display name,price,pages of book using pointer to structure*/ #include void main() { struct book { char name[10]; float price; int pages; }b; struct book *p; 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\tname=%s \n\tprice=%f \n\tpages=%d",p->name,p->price,p->pages); }
#include void main() { struct book { char name[10]; float price; int pages; }b; struct book*p; {printf("\n enter the name of book"); scanf("%s",p->name); printf("\n enter the price of book"); scanf("\%f",&p->price); printf("\n enter the pages of book"); scanf("\%d",&p->pages); printf("\n\tbook name=%s,book price=%f,book pages=%d",p->name,p->price,p->pages); } }
// accept the information of book using pointer #include void main() { struct book { char name[10]; float price; int pages; }b; struct book *ptr,p; ptr=&p; printf("\n\tEnter book name\nprice\npages"); scanf("%s\t%f\t%d",ptr->name,&ptr->price,&ptr->pages); printf("\nBook name=%s \tBook price=%f \t Book pages=%d",ptr->name,ptr->price,ptr->pages); }
/* pointer to structure*/ #include void main() { struct book { char name[10]; int pages; float price; }b; struct book *p; printf("\n\t enter name"); scanf("%s",p->name); printf("\n\t enter pages"); scanf("%d",&p->pages); printf("\n\t enter price"); scanf("%f",& p->price);
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*/ #include void main() { struct book { char name[20]; int price; int pages; }b; struct book *p; { printf("\n enter name"); scanf("%s",p->name); printf("\n enter price"); scanf("%d",&p->price); printf("\n enter pages"); scanf("%d",&p->pages); printf("\n\t name=%s price=%d pages=%d",p->name,p->price,p->pages); } }
/* 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); }
/* accept the information of book using pointer */
ReplyDelete#include
void main()
{
struct book
{
char name[10];
float price;
int pages;
}b;
struct book *p;
printf("Enter NAME of book...");
scanf("%s",p->name);
printf("Enter Price of book...");
scanf("%f",&p->price);
printf("Enter Pages of book...");
scanf("%d",&p->pages);
printf("\nBook name=%s \nBook Price=%f \n Book Pages=%d\n",p->name,p->price,p->pages);
}
/* accept the information of book using pointer */
ReplyDelete#include
void main()
{
struct book
{
char name[10];
float price;
int pages;
}b;
struct book *p;
printf("Enter NAME of book...");
scanf("%s",p->name);
printf("Enter Price of book...");
scanf("%f",&p->price);
printf("Enter Pages of book...");
scanf("%d",&p->pages);
printf("\nBook name=%s \nBook Price=%f \n Book Pages=%d\n",p->name,p->price,p->pages);
}
#include
ReplyDeletevoid main()
{
int i;
struct Book
{
char name[2];
float price;
int pages;
}b[2];
struct Book *ptr;
printf("\nEnter the Name, Price,Pages of book \n");
scanf("%s%f%d",b->name,&b->price,&b->pages);
printf("\nName=%s\nPrice=%f\nPages=%d\n",b->name,b->price,b->pages);
}
/* accept the information of book using pointer */
ReplyDelete#include
void main()
{
struct book
{
char name[10];
float price;
int pages;
}b;
struct book *p;
printf("Enter NAME of book...");
scanf("%s",p->name);
printf("Enter Price of book...");
scanf("%f",&p->price);
printf("Enter Pages of book...");
scanf("%d",&p->pages);
printf("\nBook name=%s \nBook Price=%f \n Book Pages=%d\n",p->name,p->price,p->pages);
}
#include
ReplyDeletevoid main()
{
struct book
{
char name[50];
float price;
int page;
}b;
struct book *p;
p=&b;
printf("\nEnter a name of book:\n");
scanf("%s",p->name);
printf("\nEnter a price of book:\n");
scanf("%f",&p->price);
printf("\nEnter a pages of book:\n");
scanf("%d",&p->page);
printf("\nName of book=%s\nPrice of book=%f\nPages of book=%d",p->name,p->price,p->page);
}
#include
ReplyDeletevoid main()
{
struct Book
{
char name[10];
float price;
int pages;
}b;
struct Book *ptr
printf("\n\tEnter Name of Book\n\t");
scanf("%s",b->name);
printf("\n\tEnter price of Book\n\t");
scanf("%f",&b->price);
printf("\n\tEnter Pages of Book\n\t");
scanf("%d",&b->pages);
printf("Book Name=%s,Book Price=%f,Book pages=%d",b->name,b->price,b->pages);
}
#include
ReplyDeletevoid main()
{
struct book
{
char name[50];
float price;
int page;
}b;
struct book *p;
p=&b;
printf("\nEnter a name of book:\n");
scanf("%s",p->name);
printf("\nEnter a price of book:\n");
scanf("%f",&p->price);
printf("\nEnter a pages of book:\n");
scanf("%d",&p->page);
printf("\nName of book=%s\nPrice of book=%f\nPages of book=%d",p->name,p->price,p->page);
}
#include
ReplyDeletevoid main()
{
struct book
{
char name[10];
float price;
int pages;
}b;
struct book *p;
p=&b;
printf("\n\tEnter the book name");
scanf("%s",p->name);
printf("\n\tEnter the price name");
scanf("%f",&p->price);
printf("\n\tEnter the pages name");
scanf("%d",&p->pages);
printf("\n\tBook name=%s,Book price=%f,Book pages=%d",p->name,p->price,p->pages);
}
#include
ReplyDeletevoid main()
{
struct Book
{
char name[20];
float price;
int pages;
}b;
struct Book *ptr;
ptr=&b;
printf("\nEnter the name ,price,pages of book\n");
scanf("%s%f%d",ptr->name,&ptr->price,&ptr->pages);
printf("\nName=%s \nPricse=%f \nPages=%d\n",ptr->name,ptr->price,ptr->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);
}
only here lies a correct propgram!!Check it out!!
ReplyDelete#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);
}
/*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
ReplyDeletevoid main()
{
struct book
{
char name[20];
float price;
int pages;
}p;
struct book *b;
b=&p;
printf("\nBook name=");
scanf("%s",b->name);
printf("\nPrice=");
scanf("%f",&b->price);
printf("\nenter no of pages=");
scanf("%d",&b->pages);
printf("name of book=%s\tprice=%f\tpages=%d\n",b->name,b->price,b->pages);
}
/* using pointer to structure */
ReplyDelete#include
void main()
{
struct book
{
char name[10];
float price;
int pages;
}b;
struct book *p;
printf("Enter the name of book");
scanf("%s",p->name);
printf("\n\t enter price");
scanf("%f",&p->price);
printf("\n\t enter pages");
scanf("%d",&p->pages);
printf("\n\t name=%s\n\tprice=%f\n\tpages=%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);
}
#include
ReplyDeletevoid main()
{
struct book
{
char name[20];
float price;
int pages;
}x;
struct book *p;
p=&x;
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
ReplyDeletevoid main()
{
struct book
{
char name[20];
float price;
int pages;
}b;
struct book *k;
k=&b;
printf("\n Book name=");
scanf("%s",k->name);
printf("\n Price=");
scanf("%f",&k->price);
printf("\n Enter no of pages=");
scanf("%d",&k->pages);
printf(" \n Name of book=%s \t Price of book=%f \tPages in book=%d \n",k->name,k->price,k->pages);
}
/*display name,price,pages of book using pointer to structure*/
ReplyDelete#include
void main()
{
struct book
{
char name[10];
float price;
int pages;
}b;
struct book *p;
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\tname=%s \n\tprice=%f \n\tpages=%d",p->name,p->price,p->pages);
}
// structure of book by using pointer to structure
ReplyDelete#include
#include
void main()
{
struct book
{
char name[10];
float price;
int pages;
}b;
struct book *p;
printf("Enter NAME of book...");
scanf("%s",p->name);
printf("Enter Price of book...");
scanf("%f",&p->price);
printf("Enter Pages of book...");
scanf("%d",&p->pages);
printf("\nBook name=%s \nBook Price=%f \n Book Pages=%d\n",p->name,p->price,p->pages);
}
#include
ReplyDeletevoid main()
{
struct book
{
char name[10];
float price;
int pages;
}b;
struct book*p;
{printf("\n enter the name of book");
scanf("%s",p->name);
printf("\n enter the price of book");
scanf("\%f",&p->price);
printf("\n enter the pages of book");
scanf("\%d",&p->pages);
printf("\n\tbook name=%s,book price=%f,book pages=%d",p->name,p->price,p->pages);
}
}
#include
ReplyDeletevoid 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);
}
// accept the information of book using pointer
ReplyDelete#include
void main()
{
struct book
{
char name[10];
float price;
int pages;
}b;
struct book *ptr,p;
ptr=&p;
printf("\n\tEnter book name\nprice\npages");
scanf("%s\t%f\t%d",ptr->name,&ptr->price,&ptr->pages);
printf("\nBook name=%s \tBook price=%f \t Book pages=%d",ptr->name,ptr->price,ptr->pages);
}
/* pointer to structure*/
ReplyDelete#include
void main()
{
struct book
{
char name[10];
int pages;
float price;
}b;
struct book *p;
printf("\n\t enter name");
scanf("%s",p->name);
printf("\n\t enter pages");
scanf("%d",&p->pages);
printf("\n\t enter price");
scanf("%f",& p->price);
printf("name=%spages=%dprice=%f",p->name,p->pages,p->price);
}
#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*/
ReplyDelete#include
void main()
{
struct book
{
char name[20];
int price;
int pages;
}b;
struct book *p;
{
printf("\n enter name");
scanf("%s",p->name);
printf("\n enter price");
scanf("%d",&p->price);
printf("\n enter pages");
scanf("%d",&p->pages);
printf("\n\t name=%s price=%d pages=%d",p->name,p->price,p->pages);
}
}
/* 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);
}