How to print byte array in golang?

Hi Friends 👋,

Welcome To aGuideHub! ❤️

Today, we will learn to print byte array in golang, here we will use the fmt.print() method to show byte array in output.

Let’s create some byte array type variable.

package main
import "fmt"

func main() {
  b := []byte("ABC€")
  s := []byte{65, 66, 67, 226, 130, 172}
  fmt.Print(b);
  fmt.Print("\n");
  fmt.Print(s);
}

In the above code, we have created two variables and print one after one for the output following the below image.

print, byte array, golang

Try it yourself

All the best 👍

Premium Content

You can get all the below premium content directly in your mail when you subscribe us

Books

Interview Questions

Soon You will get CSS, JavaScript, React Js, and TypeScript So Subscribe to it.

Portfolio Template

View | Get Source Code

Cheat Sheets

Cheat Sheets Books are basically Important useful notes which we use in our day-to-day life.

Related Posts