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 178 views
178 views asked Apr 19, 2023 by avibootz
5 answers 543 views
543 views asked Aug 22, 2022 by avibootz
1 answer 278 views
1 answer 255 views
1 answer 279 views
279 views asked Apr 30, 2019 by avibootz
1 answer 303 views
...