Saturday, 28 September 2013

Double scripted array as an lvalue

Double scripted array as an lvalue

I was wondering, how would i express it in code?
rand() % 2 == 0 ? map[x][y] = 'm' : map[x][y] = 'M';
when I compile that line in g++, it doesn't give an error. However gcc
tells me I need an lvalue left of the assignment statement. I thought
maybe I should give them an integer
int i = rand() % 2 ? .......
but that also gives me an error. Can someone please help? Thanks

No comments:

Post a Comment