code below is showing lvalue required error. why is it? how can it be corrected?
Code:char c[10]; c='!';
code below is showing lvalue required error. why is it? how can it be corrected?
Code:char c[10]; c='!';
Last edited by bluerose; 02-16-2012 at 02:28 PM.
You can't assign to an array in the manner you are attempting. In your code, c is the array and in the above context represents the address of the array on the stack. This can't be changed by assigning a new value to it as it is fixed when the program is executed. You probably wanted something more like this:
The above code assign a char to a specific element/position within the array.Code:c[0] = '!';
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
thank you