Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to swap two values in golang?



How to swap two values in golang?..

Answer / Amaresh Kumar

To swap two variables in Go programming language, you can use a temporary variable. Here's an example: `temp := a; a = b; b = temp`. However, Go provides a simpler way using the `^` operator: `a, b = b, a`.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Go Programming Language Interview Questions

How will you access command line arguments in a go program?

1 Answers  


What type assertion is used for and how it does it?

1 Answers  


What is the usage of goto statement in go programming language?

1 Answers  


Does go (golang) support type inheritance?

1 Answers  


Why does my go process use a lot of virtual memory?

1 Answers  


What is type assertion in go? What does it do?

1 Answers  


Explain what gopath environment variable is?

1 Answers  


What is the syntax for creating a function?

1 Answers  


How we can print type of a variable in go programming?

1 Answers  


What are the several built-in supports in go?

1 Answers  


What is type assertion in go?

1 Answers  


How you can do testing in go?

1 Answers  


Categories