Accessing pointer member of the structure using structure pointer : <p>I have defined integer pointer inside the structure.And i want to use that member pointer using the structure pointer.My code is as shown below:</p>

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

struct abc
{
        int *x;
};

int main()
{

        struct abc *p = (struct abc*)malloc(sizeof(struct abc));
        p-&gt;x = (int*)malloc(sizeof(int));
        p-&gt;x = 10;
        printf("The value is %d\n",p-&gt;x);
        free(p);
}
</code></pre>

<p>Now i am getting output as per my expectation.But i have got warning message while compiling.The warning messages are:</p>

<pre><code>temp.c:14:7: warning: assignment makes pointer from integer without a cast [enabled by default]
temp.c:15:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat]
</code></pre>

<p>I have also tried,</p>

<pre><code>*p-&gt;x = 10
 printf("The value is %d\n",*p-&gt;x);
</code></pre>

<p>but it is not working.</p>

<p>How to solve this warning?</p>
