Hi,
--- On Fri, Jul 3, 2009 at 9:15 AM, abhishek
sharma<[email protected]> wrote:
| int *p=c; //For this code
| gcc compiles normally without any error or problem
\--
This is correct.
---
| 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.
1. Don't use // comments in C coding style.
2. Initialize your pointer variables, or assign NULL to them.
int *p = NULL;
SK
--
Shakthi Kannan
http://www.shakthimaan.com
_______________________________________________
Users mailing list
[email protected]
http://lists.dgplug.org/listinfo.cgi/users-dgplug.org