CSE 116 Study Guide - Local Variable
Document Summary
Reflections on hw1 - the count_e method. Hw1 reflections, page 1. At the completion of the method the value of the. This returned value becomes the value of the method call expression. The value of the expression count_e( electric ) is 2, since there are two e" characters in electric . A diagram showing the flow of control through this code is given on the next page. S" is the parameter of the method named count_e". It is a local variable whose initial value is given by the argument provided in a method call. For example, electric is the argument in the call. Valid indices for a string range from 0 (zero) to one less than the length of the string. This expression is true if and only if the character in the j- th position of the string s is e". S" is assigned the value of the method call"s argument. Count" is assigned 0 (zero)