[C#] 예약어(checked , unchecked), params
[C#] 예약어(checked , unchecked), params - checked : 오버플로, 언더플로가 자동으로 되는 것을 방지하고 오류를 출력 - unchecked : 오버플로, 언더플로가 일어나도 오류를 출력하지 않는다. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApp__Checked { class Program { static void Main(string[] args) { short c1 = 32767; c1++; Console.WriteLine(c1); // 출력결과 -32768 : 오버플로 int n1 = 32768; c1 = (short)n1; Console.WriteLine(c1); // 출력결과 -32768 : 오버플로 short c2 = -32768; c2--; Console.WriteLine(c2); //출력결과 32767 : 언더플로 short c = 32767; int n = 32768; //오버플로, 언더플로가 자동으로 되는 것을 방지하고 오류를 출력 checked checked { c++; } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.T...