Search This Blog

Translate

c structure program example with micro

C Simple structure program using micro how to write C Simple structure program using micro with source code,c program example of pre processor with source code . micro in c, how to define micro , how to define nested micro in c , what is linkfloat() function, structure program print list of book using micro wtih souce code


#include<stdio.h>

#include<conio.h>
#define MX 1
struct book{ int id;
    char name[100];
    float price;
    } b[MX];


void main()
{
 int i;
 clrscr();
 for(i=0;i<MX;i++)
 {
   printf("\n ___________________________________\n ");
   printf("\n \t %d .Enter Book id  :",i+1);
scanf("%d",&b[i].id);
fflush(stdin);
   printf("\n \t %d .Enter Book Name :",i+1);
gets(b[i].name);
fflush(stdin);
   printf("\n \t %d .Enter Book Price : ",i+1);
scanf("%f",&b[i].price);
 }


    printf("\n _______________*** List Of Books ****____________________\n ");

 for(i=0;i<MX;i++)
 {
   printf("\n \t %d .Book id  : %d",i+1 ,b[i].id);
   printf(" \t Book Name : %s",b[i].name);
   printf("\t Price :%f ",b[i].price);
   printf("\n ____________________________________________________________\n ");
 }


 getch();



}
void linkflaot() // funcion to fix linkfloat error
{
 float a,*ptr;
 ptr=&a;

}

output:



C Program example List

Google+ Badge