C# −
-এ নিচের অপারেটরগুলো রয়েছে+ - ! ~ ++ -- (type)* & sizeof
আসুন অপারেটরের আকার সম্পর্কে জেনে নিই। সাইজফ একটি ডেটা টাইপের আকার প্রদান করে।
ধরা যাক আপনাকে int ডেটাটাইপ -
এর আকার খুঁজে বের করতে হবেsizeof(int)
ডাবল ডেটাটাইপ -
এর জন্যsizeof(double)
বিভিন্ন ডেটাটাইপ -
এর আকার খুঁজে বের করার জন্য সম্পূর্ণ উদাহরণটি দেখা যাকউদাহরণ
using System;
namespace Demo {
class Program {
static void Main(string[] args) {
Console.WriteLine("The size of int is {0}", sizeof(int));
Console.WriteLine("The size of int is {0}", sizeof(char));
Console.WriteLine("The size of short is {0}", sizeof(short));
Console.WriteLine("The size of long is {0}", sizeof(long));
Console.WriteLine("The size of double is {0}", sizeof(double));
Console.ReadLine();
}
}
} আউটপুট
The size of int is 4 The size of int is 2 The size of short is 2 The size of long is 8 The size of double is 8