Hi
this code provides those values: 100 100 150 100.
I expected this: 100 100 150 150. Why is the last value not changed? I thought int variabele are of the type value and not type reference.
Thanks
static void Main(string[] args)
{
int n = 100;
int n2 = n;
Console.WriteLine(n);
Console.WriteLine(n2);
n = 150;
Console.WriteLine(n);
Console.WriteLine(n2);
}

Sachin SinghRank #66 · 26.2K reputationPosted Jun 22, 2021, 5:51 AM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Jun 22, 2021, 5:50 AM EDT
Valerie MeunierRank #1,527 · 1K reputationPosted Jun 22, 2021, 6:32 AM EDT