Structure pointer

1
2
3
4
5
6
7
  struct Book {
    string title;
    int year_published;
  } book[3];

  Book *p_book;
  p_book = &book;


I see this while compiling:
structures.cpp:32: error: incompatible types in assignment of `Book (*)[3]' to `Book*[3]'

Please explain. Hope you get it.
array name is address to the 1st element, so it should be p_book = book; or p_book = &book[0];
Last edited on
Topic archived. No new replies allowed.