What is a data type?
Experience Level: Junior
Tags: C#
Answer
Data type in programming describes what value the variable can hold. Different values can have different data types.
Let's take an Age of a person as an example.
If we are talking about age, we could maybe agree the age could be numeric value. So it will be a number. But will it be an integer or decimal number? Will the Age be defined in number of years or number of months or maybe minutes or seconds? Someone doesn't care whether a persion is 30 or 31 years old. But what if you want to be more precise? What if you want to measuere how many days are remaining to person's next birthday? In such situation knowing that person is 30 years old would be different than knowing that persion is 30.2 years old, right?
Related C# job interview questions
What is an object reference in C#?
C# JuniorWhat C# data types do you know?
C# JuniorHow do you recognize a method call in C#?
C# JuniorWhat is a method in C# and how do you define one?
C# JuniorWhat is a constructor in C# and why would you use it?
C# Junior