0

What output this example ?

This example fell into the task, tell me what is the catch ? *** string s = "str"; string a = s; s = "rts"; Console.Write(a); // Answer - str . Why ?

6th Dec 2019, 7:38 AM
Иван Пунько
Иван Пунько - avatar
2 ответов
+ 4
Because you assigned the value of s to a. And you are printing a not s.
6th Dec 2019, 7:52 AM
A͢J
A͢J - avatar
0
Thanks
6th Dec 2019, 9:51 AM
Иван Пунько
Иван Пунько - avatar