Go Miscellaneous Operators And Operator Precedence
Go Language - Miscellaneous Operators and Operator Precedence
Miscellaneous Operators :
Example :
CODE/PROGRAM/EXAMPLE
package main
import "fmt"
func main() { //example of & and * operators
var a int = 6
var ptr *int
ptr = &a /* ptr has the address of a*/
fmt.Printf("value of a is %d\n", a);
fmt.Printf("*ptr is %d.\n", *ptr);
}
Output:
value of a is 6
*ptr is 6.
Operator Precedence :
Operator Precedence identifies the clustering of terms in expression and it affects the evaluation of the expression. Each operator has the precedence over the other operators. The operators with the highest precedence will be executed first.