How to correctly fix 'ptr to const' to 'ptr' error?
Posted on 2011-02-15
In a 'C' language program, pointer to constant is assigned to a pointer.
The compiler gives an error on this assignment because pointer to const is being assigned to a pointer.
What is the correct or best way to fix this error? One way to fix this error is to typecast RHS of the assignment statement to pointer. Is that the correct fix?
What might be some situations where pointer to const needs to be assigned to pointer?
Is it sloppy code to define pointer which will be assigned pointer to const?
Please provide some exampels to this issue.