c# data types

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/24

encourage image

There's no tags or description

Looks like no tags are added yet.

25 Terms

1
New cards

variables

container for storing data values

2
New cards

int

stores whole numbers w/o decimals

3
New cards

double

stores floating point numbers, with decimals,

4
New cards

char

stores single characters, surrounded by ‘single quotes’

5
New cards

string

stores text, surrounded by “double quotes”

6
New cards

bool

stores values with two states: true or false

7
New cards

const

unchangeable and read only, to not overwrite existing values

8
New cards

WriteLine()

this method is often used to display variable values to the console window

9
New cards

comma-separated list

used To declare more than one variable of the same type,

10
New cards

indentifiers

All C# variables must be identified with unique names.

These unique names are called

11
New cards

short names

identifiers like x and y

12
New cards

descriptive names

identifiers like age, sum, totalVolume

this is recommended to use in order to create understandable and maintainable code

13
New cards

can contain letters, digits, and underscores

must begin with a letter or underscore

should start with lowercase letter and cannot contain whitespace

case sensitive

reserved words cannot be used as names

general rules for naming variables

14
New cards

data type

specifies the size and type of variable values.

use the correct data type for the corresponding variable; to avoid

errors, to save time and memory,

will also make your code more maintainable

and readable.

15
New cards

long

like int, but can store whole numbers from -9 quintillion to 9 quintillion

16
New cards

float

stores fractional numbers, sufficient for storing 6-7 decimal digits

17
New cards

double

stores fractional numbers, sufficient for storing 15 decimal digits

preferred

18
New cards

integer and floating point

number types are divided into two groups

19
New cards

integer types

stores whole numbers, positive or negative (such as 123 or -456),

without decimals. Valid types are int and long. Which type you should use, depends

on the numeric value.

20
New cards

floating point types

represents numbers with a fractional part, containing one or more decimals. Valid types are float and double.

21
New cards

scientific numbers

A floating-point number can also be a scientific number with an "e" to indicate the power of 10:

22
New cards

type casting

is when you assign a value of one data type to another type.

23
New cards

implicit casting

converting a smaller type to a larger type size

char -> int -> long -> float -> double

24
New cards

explicit casting

converting a larger type to a smaller size type

double -> float -> long -> int -> char

25
New cards

Console.ReadLine()

to get user input

can be used too get input directly as a string