Unformatted text preview: count_spaces( str ): set k to 0 set spaces to 0 while str[k] != „ \0 ‟ do if str[k] == „ „ then set spaces to spaces + 1 set k to k + 1 return spaces end main: set s to “ one two three ” set count to count_spaces(s) print count //This should print 2 end...
View
Full Document
 Spring '11
 aren
 return spaces

Click to edit the document details