How does this C code work but the other says L-value required? : <p>This code works fine when b is incremented and a is printed upon increment</p>

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

int main()
{
int a[] = {10,20,30,40,50}, *p, j;
int *b = a;
for(j=0;j&lt;5;j++)
{
printf("%d\n",*b);
b++;
}
return 0;
}
</code></pre>

<p>What happens here? What effect does a++ have here to suggest <code>lvalue</code> is required. Does a++ move to a point after all the elements of the array a?</p>

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

int main()
{
int a[] = {10,20,30,40,50}, *p, j;
for(j=0;j&lt;5;j++)
{
printf("%d\n",*a);
a++;
}
return 0;
}
</code></pre>
