Warning: assignment from incompatible pointer type at malloc?
<p>I watched the other two questions about this problem, but I think they are different. Thanks for your help. Problem is in the 18th line.  </p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;ctype.h&gt;

typedef struct x {
   char name1[30];
   char name2[30];
} x;

int main() {
    int *ptr;
    x array[2] = {
        { "Apple", "Battle" },
        { "Cup", "Dog" },
    };
    ptr = (x*)malloc(sizeof(x)); /*assignment from incompatible pointer type*/
    printf("write something");
    scanf("%s", array[3].name1);

    free(ptr);

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