kk
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
module main.go
|
||||
|
||||
go 1.24.4
|
||||
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// var variable int = 30
|
||||
// var pointer *int = &variable
|
||||
|
||||
// fmt.Printf("Type of pointer %T\n",pointer)
|
||||
// fmt.Printf("Value of pointer %v\n",pointer)
|
||||
|
||||
// secondPtr := &pointer
|
||||
// fmt.Println("Pointer to pointer",secondPtr)
|
||||
|
||||
|
||||
// zeroPtr := new(int)
|
||||
// *zeroPtr += 40
|
||||
// fmt.Println("Address is ",*zeroPtr)
|
||||
|
||||
|
||||
// a := 10
|
||||
// c := a
|
||||
// b := &a
|
||||
// *b += 2
|
||||
|
||||
// c++
|
||||
// fmt.Printf("Val of A is %d and val of C is %d\n",a, c)
|
||||
// fmt.Printf("Val of A after changing ref is %d",a)
|
||||
|
||||
sample := 1
|
||||
// samplePtr := &sample
|
||||
fmt.Println("Sample val is",sample)
|
||||
kek(sample)
|
||||
fmt.Println("Sample val is",sample)
|
||||
|
||||
}
|
||||
|
||||
func kek(val int) {
|
||||
fmt.Println("Val of val is",val)
|
||||
val += 100
|
||||
}
|
||||
Reference in New Issue
Block a user