Incompatible types - is it because an array is already a pointer?
<p>In the below code I create an object based off of the books structure, and to have it hold multiple "books" I set is an array (the object that is defined/initiated, that is). However, whenever I went to test my knowledge of pointers (the practice helps) and attempted to make a pointer that points to the created object, it gives me the error:</p>

<p><em>C:\Users\Justin\Desktop\Project\wassuip\main.cpp|18|error: incompatible types in assignment of 'books</em>' to 'books* [4]'|*</p>

<p>May I ask, is this because the object book_arr[] is already considered a pointer as it's an array? Thanks (new to C++ and just want to verify).</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;sstream&gt;

#define NUM 4

using namespace std;

struct books {
    float price;
    string name;
    int rating;
} book_arr[NUM];

int main()
{
    books *ptr[NUM];
    ptr = &amp;book_arr[NUM];

    string str;

    for(int i = 0; i &lt; NUM; i++){
        cout &lt;&lt; "Enter book name: " &lt;&lt; endl;
        cin &gt;&gt; ptr[i]-&gt;name;
        cout &lt;&lt; "Enter book price: " &lt;&lt; endl;
        cin &gt;&gt; str;
        stringstream(str) &lt;&lt; ptr[i]-&gt;price;
        cout &lt;&lt; "Enter book rating: " &lt;&lt; endl;
        cin &gt;&gt; str;
        stringstream(str) &lt;&lt; ptr[i]-&gt;rating;
    }

    return 0;
}
</code></pre>

<p>*<em>NEW CODE AFTER ANSWERS (NO ERRORS) *</em></p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;sstream&gt;

#define NUM 4

using namespace std;

/* structures */
struct books {
    float price;
    string name;
    int rating;
} book[NUM];

/* prototypes */
void printbooks(books book[NUM]);

int main()
{
    string str;

    books *ptr = book;

    for(int i = 0; i &lt; NUM; i++){
        cout &lt;&lt; "Enter book name: " &lt;&lt; endl;
        cin &gt;&gt; ptr[i].name;
        cout &lt;&lt; "Enter book price: " &lt;&lt; endl;
        cin &gt;&gt; str;
        stringstream(str) &lt;&lt; ptr[i].price;
        cout &lt;&lt; "Enter book rating: " &lt;&lt; endl;
        cin &gt;&gt; str;
        stringstream(str) &lt;&lt; ptr[i].rating;
    }

    return 0;
}

void printbooks(books book[NUM]){
    for(int i = 0; i &lt; NUM; i++){
        cout &lt;&lt; "Title: \t" &lt;&lt; book[i].name &lt;&lt; endl;
        cout &lt;&lt; "Price: \t$" &lt;&lt; book[i].price &lt;&lt; endl;
        cout &lt;&lt; "Racing: \t" &lt;&lt; book[i].rating &lt;&lt; endl;
    }
}
</code></pre>
