Thanks for the explanation, I knew the second example was wrong and what
was the correct way to do it, just was not sure about--
"What makes it go wrong, precisely" ?
> On Fri, Jul 3, 2009 at 10:24 AM, Shakthi Kannan <[email protected]>wrote:
>
> | int c[5]={1,2,3,4,5};
>> |
>> | int *p;
>> |
>> | *p=c; //GCC gives a typecast
>> \--
>>
>> It should be 'p = c'. On the left-hand side of the assignment there
>> should be an address or LVALUE. On the right-hand side of the
>> assignment you should have a value or RVALUE. When you do *p on the
>> left-hand side of the assignment, you are dereferencing the address or
>> pointer, to get a RVALUE. Hence, the error.
>>
>> I know what the correct way should be ( p=c, as also explained by
shakti above) .I wanted to know what happens when we do a wrong
assignment (as in what the compiler internally does).I guess Shakti's
explaination above suffices.
Anyone who might want to comment further is please welcome.
--
Hermes
Think Free, Think Open Source
_______________________________________________
Users mailing list
[email protected]
http://lists.dgplug.org/listinfo.cgi/users-dgplug.org