#include<stdio.h>
int main()
{
    int i;
    typedef struct BookDB
    {
        int iPageNo[10];
        char cBookName[10];
    }  b1[5],*b2;
//  *pvBookDB = &vBookDB;
    b2 = &b1;
    printf("Enter the pageno folloed by bookname for 5 books at at time");
    for(i=0;i<=5;i++)
    {
    scanf("%d,%s",b2[i].iPageNo,b2[i].cBookName);
    }
    for(i=0;i<=5;i++)
    {
    printf("%d,%s",b2[i]->iPageNo,b2[i]->cBookName);
    }
    return 0;
}

Recommended Answers

b2 = &b1[0];
(b2+i)->iPageNo

And no need of typedef

Jump to Post

All 2 Replies

b2 = &b1[0];
(b2+i)->iPageNo

And no need of typedef

Dude where is the '&' operator in the scanf function???? :-O

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.