Needs to be modifiable value

I am trying to create a text RPG with an ability check system similar to dungeons and dragons. I wanted to make a function that I could call any time I wanted to make an ability check, but I came accross the error:
expression must be a modifiable Ivalue, but I need the variable to be used to substitute for other variables in the parameter.
1
2
3
4
5
  int abilityCheck(int x) {
        //x = the ability
	x +(rand() % 30 + 1) = ability_check_result;
	return ability_check_result;
  }
I need the variable to be used to substitute for other variables in the parameter.
Can you clarify this statement? I don't understand what you're trying to do.

The thing to the left of an assignment must have a memory location. For example, all of the following assignments are invalid:
1
2
3
4
5
1 = 1;
1 + 1 = 2;
a + 1 = 2;
a + 1 += 2;
++1;
Topic archived. No new replies allowed.