Skip to content

Commit

Permalink
read.go init value with constrain
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangbits committed May 24, 2020
1 parent e6336ed commit cd632fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions c1-m4-activity/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ func main() {
text := scanner.Text()
for pos, char := range []byte(text) {
if char == ' ' {
tempName := Name{string(text[:pos]), string(text[pos+1:])}
names = append(names, tempName)
var tempName = &Name{}
tempName.InitMe(string(text[:pos]), string(text[pos+1:]))
names = append(names, *tempName)
}
}
}
Expand Down

0 comments on commit cd632fb

Please sign in to comment.