What is the output from the following code
using System; struct Point{ int x = 3, y; public Point (int x, int y) { this.x = x; this.y = y; } } class MainClass{ public static void Main(string[] args){ Point p1 = new Point (); Point p2 = new Point (1, 1); Console.WriteLine(p1.x); Console.WriteLine(p2.x); } }
int x = 3 // Illegal: field initializer
You can't have field initializers in struct.