You are using double equal signs before returning when setting c in the second example. It should be c='G' not c=='G'.
== does not modify the value but rather compares two values to see if they are equal (thus why its used in if statements). = alone sets it.