Golang program to add value to a 64-bit unsigned integer in an uninterruptible manner
belongs to collection: Golang sync/atomic Package Programs
All Answers
total answers (1)
belongs to collection: Golang sync/atomic Package Programs
total answers (1)
Program/Source Code:
The source code to add value to a 64-bit unsigned integer in an uninterruptible manner is given below. The given program is compiled and executed on the ubuntu 18.04 operating system successfully.
Output:
Explanation:
In the above program, we declare the package main. The main package is used to tell the Go language compiler that the package must be compiled and produced the executable file. Here, we imported the required packages to predefined functions.
In the main() function, we created two 64-bit unsigned integer variables. Then we added the values to the variables using the atomic.AddUint64() function one by one. After that, we printed the result on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer