trying to store a changing variable using str::size in a seperate variable

Back again, I'm trying to get the size of 'str' by the .size function. I have an int variable to store the results in.
1
2
3
4
  String str = "hello";
  Int strchar;

    Str.size() = strchar;


I only need my program to loop as many times as the size or length of the str value. I have also tried using:

Str.length = strchar

And im getting the :

Error: lvalue required as left operand of assignment

I was hoping someone could judge me in the right direction as to where I'm going wrong
Last edited on
You have the assignment statement with the operands on the wrong side of the = sign.
1
2
3
int x = 5; // ok - declare variable x and give it an initial value of 5
x = 17;    // ok - give x the new value of 17
4 = x;     // error - attempt to give a new value of 17 to the number 4. 
Last edited on
Topic archived. No new replies allowed.