// ========================================================================== // $Id: point.go,v 1.1 2014/03/27 03:27:49 jlang Exp $ // CSI2120 GO: Structures and Pointers // ========================================================================== // (C)opyright: // // Jochen Lang // EECS, University of Ottawa // 800 King Edward Ave. // Ottawa, On., K1N 6N5 // Canada. // http://www.eecs.uottawa.ca // // Creator: Jochen Lang (based on example by R. Laganiere) // Email: jlang@eecs.uottawa.ca // ========================================================================== // $Log: point.go,v $ // Revision 1.1 2014/03/27 03:27:49 jlang // Created Go examples for intro lecture. // // ========================================================================== package main import "fmt" type Point struct { x int y int } func main() { pt := Point{8, 1} complement(&pt) fmt.Printf("Result= %d and %d\n", pt.x , pt.y) } func complement(p *Point) { p.x, p.y = -p.y, -p.x }