I'm using Code::Blocks 16.01 on Raspbian Stretch for C. In the following program, when I un-comment the 'veg++' line, it doesn't run.
int main()
{
char *veg[] =
{
"corn",
"carrot",
"pea"
};
for(int i = 0; i < 3; i++)
{
puts(veg[i]); // this works
puts(*(veg + i)); // this works
//puts(*(veg++)); // this does not work
}
return 0;
}
I get the build message: "....main.c|848|error: lvalue required as increment operand|"
Why is 'veg + 1' different from 'veg++'? It probably goes without saying I'm a beginner.