sizeof Keyword C# with Example



sizeof Keyword C# with Example

 	using System;

	namespace CSharpClass
	{
		public struct Coordinate
		{
			public int x, y;
		}
		
		class UsingPointers
		{
			unsafe static void UseSizeOfOperator()
			{
				Console.WriteLine("The size of short is {0}.", sizeof(short));
				Console.WriteLine("The size of int is {0}.", sizeof(int));
				Console.WriteLine("The size of long is {0}.", sizeof(long));
				Console.WriteLine("The size of Coordinate is {0}.", sizeof(Coordinate));
			}

			static void Main()
			{
				unsafe
				{
					UseSizeOfOperator();
				}
			}
		}
	} 

0 Comment's

Comment Form

Submit Comment