mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
595 B
38 lines
595 B
5 years ago
|
## point
|
||
6 years ago
|
|
||
6 years ago
|
### Instructions
|
||
6 years ago
|
|
||
5 years ago
|
Create a `.go` file.
|
||
|
|
||
5 years ago
|
- The code below has to be copied in that file.
|
||
5 years ago
|
|
||
5 years ago
|
- The necessary changes have to be applied so that the program works.
|
||
6 years ago
|
|
||
5 years ago
|
- The program must be submitted inside a folder with the name `point`.
|
||
6 years ago
|
|
||
5 years ago
|
### Code to be copied
|
||
|
|
||
6 years ago
|
```go
|
||
|
func setPoint(ptr *point) {
|
||
6 years ago
|
ptr.x = 42
|
||
|
ptr.y = 21
|
||
6 years ago
|
}
|
||
|
|
||
|
func main() {
|
||
6 years ago
|
points := &point{}
|
||
|
|
||
|
setPoint(points)
|
||
6 years ago
|
|
||
5 years ago
|
fmt.Printf("x = %d, y = %d\n",points.x, points.y)
|
||
6 years ago
|
}
|
||
|
```
|
||
|
|
||
5 years ago
|
### Usage
|
||
6 years ago
|
|
||
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/point$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/point$ ./point
|
||
6 years ago
|
x = 42, y = 21
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/point$
|
||
6 years ago
|
```
|