What will the following code print:
 
class Test { 
    static void increment(int p) 
    { 
      ++p; 
    } 
    static void Main( ) 
    { 
      int x = 8;
      increment(x); 
     Console.WriteLine(x++);
    } 
}
 
Explanation
X parameter is passed into the method by value. The value will be printed first and then incremented because in this case postfix operator is used
C#
C# Quiz
Learn C# Online

or Read more about C# Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback