March 2019
Intermediate to advanced
336 pages
9h 9m
English
The addOne function takes a pointer to num and increments it by 1. The function prints the value, address, and pointer of num. This is shown in the following code:
///main package has examples shown// in Go Data Structures and algorithms bookpackage main// importing fmt packageimport ( "fmt")// increment methodfunc addOne(num *int) { *num++ fmt.Println("added to num", num, "Address of num", &num, "Value Points To", *num )}
Read now
Unlock full access