Error: Assignment of read-only variable in C | Common C program Errors
Error “assignment of read-only variable in C” occurs, when we try to assign a value to the read-only variable i.e. constant.
In this program, a is a read-only variable or we can say a is an integer constant, there are two mistakes that we have made:
- While declaring a constant, value must be assigned – which is not assigned.
- We cannot assign any value after the declaration statement to a constant – which we are trying to assign.