What are the nine integral data types in C# and how do you decide which is the most appropriate to use in a particular situation?

What will be an ideal response?


The nine types are byte, sbyte, short, ushort, int, uint, long, ulong, and char. The first eight always represent whole numbers, and the ninth type, char, is used for characters like 'A' or 'a'.
The most basic of the integral types is int. An int uses four bytes of memory and can hold any whole number value ranging from 2,147,483,647 down to -2,147,483,648. Many programmers use int for most whole numbers. If you want to save memory and know you need only a small value, you can use one of the shorter integer types-byte, sbyte (which stands for signed byte), short (short int), or ushort (unsigned short int). For example, a payroll program might contain a variable named numberOfDependents that is declared as type byte, because numberOfDependents will never need to hold a negative value or a value exceeding 255; for that reason, you can allocate just one byte of storage to hold the value. If you use a type that is too large, you waste storage. If you use a type that is too small, your program won't compile.

Computer Science & Information Technology

You might also like to view...

What is fusion splicing?

a. A temporary method for splicing fiber b. An inexpensive alternative to mechanical splicing c. A type of splicing that requires index-matching gel d. A long-term method in which two fibers are fused or welded together

Computer Science & Information Technology

Compute the volume of a sphere 2 feet in diameter.

Radius = diameter / 2 = 2 / 2 = 1 Volume of sphere ![15163|207x59](upload://fOTlqnLj9Oi6Znx0wj32Bkn0Oeu.jpeg)

Computer Science & Information Technology

When you point to a brush on the Brushes panel, a(n) tool tip appears showing the brush's name.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Explain the importance of having unified design elements in a presentation.

What will be an ideal response?

Computer Science & Information Technology