atomic.StoreUint32() Function in Golang With Examples Last Updated : 01 Apr, 2020 Comments Improve Suggest changes Like Article Like Report In Go language, atomic packages supply lower-level atomic memory that is helpful is implementing synchronization algorithms. The StoreUint32() function in Go language is used to atomically store val into *addr. This function is defined under the atomic package. Here, you need to import "sync/atomic" package in order to use these functions. Syntax: func StoreUint32(addr *uint32, val uint32) Here, addr indicates address. Note: (*uint32) is the pointer to a uint32 value. However, int32 contains the set of all unsigned 32-bit integers from 0 to 4294967295. Return value: It stores the val into *addr and then can be returned when required. Example 1: C // Program to illustrate the usage of // StoreUint32 function in Golang // Including main package package main // importing fmt and sync/atomic import ( "fmt" "sync/atomic" ) // Main function func main() { // Defining variables for // the address to store the val var ( x uint32 y uint32 ) // Using StoreUint32 method // with its parameters atomic.StoreUint32(&x, 465559) atomic.StoreUint32(&y, 123) // Displays the value stored in addr fmt.Println(atomic.LoadUint32(&x)) fmt.Println(atomic.LoadUint32(&y)) } Output: 465559 123 Here, first, the uint32 value is stored in the addresses defined then they are returned using the LoadUint32() method above. Example 2: C // Program to illustrate the usage of // StoreUint32 function in Golang // Including main package package main // importing fmt and sync/atomic import ( "fmt" "sync/atomic" ) // Main function func main() { // Defining variables for the // address to store the val var ( x uint32 ) // Using StoreUint32 method // with its parameters atomic.StoreUint32(&x, 67677) // Loading the stored val z := atomic.LoadUint32(&x) // Prints true if values // are same else false fmt.Println(z == x) // Prints true if addresses // are same else false fmt.Println(&z == &x) } Output: true false Here, the value stored and loaded are same so true is returned but their addresses are not same so false is returned in that case. Comment More infoAdvertise with us Next Article atomic.StoreUint32() Function in Golang With Examples nidhi1352singh Follow Improve Article Tags : Go Language GoLang-atomic Similar Reads atomic.StoreInt32() Function in Golang With Examples In Go language, atomic packages supply lower-level atomic memory that is helpful is implementing synchronization algorithms. The StoreInt32() function in Go language is used to atomically store val into *addr. This function is defined under the atomic package. Here, you need to import "sync/atomic" 2 min read atomic.StoreUint64() Function in Golang With Examples In Go language, atomic packages supply lower-level atomic memory that is helpful is implementing synchronization algorithms. The StoreUint64() function in Go language is used to atomically store val into *addr. This function is defined under the atomic package. Here, you need to import "sync/atomic" 2 min read atomic.StoreUintptr() Function in Golang With Examples In Go language, atomic packages supply lower-level atomic memory that is helpful is implementing synchronization algorithms. The StoreUintptr() function in Go language is used to atomically store val into *addr. This function is defined under the atomic package. Here, you need to import "sync/atomic 2 min read atomic.StoreInt64() Function in Golang With Examples In Go language, atomic packages supply lower-level atomic memory that is helpful is implementing synchronization algorithms. The StoreInt64() function in Go language is used to atomically store val into *addr. This function is defined under the atomic package. Here, you need to import "sync/atomic" 2 min read atomic.Store() Function in Golang With Examples In Go language, atomic packages supply lower level atomic memory that is helpful is implementing synchronization algorithms. The Store() function in Go language is used to set the value of the Value to x(i.e, interface). And all the calls to Store method for a stated Value should use values of an id 3 min read atomic.SwapUint32() Function in Golang With Examples In Go language, atomic packages supply lower-level atomic memory that is helpful is implementing synchronization algorithms. The SwapUint32() function in Go language is used to atomically store new value into *addr and returns the previous *addr value. This function is defined under the atomic packa 2 min read atomic.LoadUint32() Function in Golang With Examples In Go language, atomic packages supply lower-level atomic memory that is helpful is implementing synchronization algorithms. The LoadUint32() function in Go language is used to atomically load *addr. This function is defined under the atomic package. Here, you need to import "sync/atomic" package in 2 min read atomic.StorePointer() Function in Golang With Examples In Go language, atomic packages supply lower-level atomic memory that is helpful is implementing synchronization algorithms. The StorePointer() function in Go language is used to atomically store val into *addr. This function is defined under the atomic package. Here, you need to import the "sync/at 2 min read atomic.SwapInt32() Function in Golang With Examples In Go language, atomic packages supply lower-level atomic memory that is helpful is implementing synchronization algorithms. The SwapInt32() function in Go language is used to atomically store new value into *addr and returns the previous *addr value. This function is defined under the atomic packag 2 min read atomic.LoadInt32() Function in Golang With Examples In Go language, atomic packages supply lower-level atomic memory that is helpful is implementing synchronization algorithms. The LoadInt32() function in Go language is used to atomically loads *addr. This function is defined under the atomic package. Here, you need to import "sync/atomic" package in 2 min read Like