How to swap two strings in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string s1 = "c#", s2 = "c++", temp;
 
        temp = s1;
        s1 = s2;
        s2 = temp;
 
        Console.WriteLine(s1 + " " + s2);
    }
}
 
 
 
  
/*
run:
  
c++ c#
  
*/

 



answered Sep 24, 2021 by avibootz

Related questions

1 answer 100 views
100 views asked Apr 19, 2023 by avibootz
5 answers 322 views
322 views asked Aug 22, 2022 by avibootz
1 answer 199 views
1 answer 161 views
1 answer 185 views
185 views asked Apr 30, 2019 by avibootz
1 answer 201 views
1 answer 111 views
...