কম্পিউটার টিউটোরিয়াল

C#-এ ইউনারি অপারেটর (Unary Operators) কী?

C#-এ ইউনারি অপারেটরগুলো নিচে দেওয়া হলো:

+ - ! ~ ++ -- (type)* & sizeof

sizeof অপারেটর সম্পর্কে জানুন। sizeof একটি ডেটা টাইপের সাইজ রিটার্ন করে।

ধরুন, আপনাকে int ডেটা টাইপের সাইজ জানতে হবে:

sizeof(int)

double ডেটা টাইপের জন্য:

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 char 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 char is 2 The size of short is 2 The size of long is 8 The size of double is 8
  1. C#-এ sizeof অপারেটরের ব্যবহার

  2. C#-এ লেফট শিফট এবং রাইট শিফট অপারেটর (>> এবং <<) কী?

  3. C#-এ রিলেশনাল অপারেটর (Relational Operators) কী কী?

  4. C#-এ লজিক্যাল অপারেটর (Logical Operators) কী কী?