What is data type? Why do we need it in programming? Explain any three basic data types with example.

This answer is restricted. Please login to view the answer of this question.

Login Now

Data types are the type of data or the category of data which we will be using for the program. For example, data 10 and 100.5 are the data of different types. Data 10 is an integer number(i.e whole number) while 100.5 is a fractional number. There are other varieties of data types supported by the C Programming, each of which may be represented differently within the computer’s memory. the variety f data type available allows the programmer to select the type needed by the application.

Basically, Data types have three classes.

  • Primary data types
  • User-defined data types
  • Derived data types

Data types are important in programming languages, so that the memory which has to be given to store a particular data that can be stored. Data types tells MMU that how much memory requirement it has before the program compiles.

Data types are important in programming language because

  1. It tells MMU(Memory Management Unit) that how much requirement it has before the program compiles.
  2. As the name suggests, it indicates the type/category of data/information. To categorize the related information/characteristics of the real world entities into few categories which can be easily understood by programs/machines in order to process them.

Here are the three basic type of data-types

1. Int

Data types that holds integer value

int hamrocsit = 100;

Here variable hamrocsit store integer value of 100.

2. Float

Data types that holds floating-point value

float hamrocsit = 64.5;

Here variable hamrocsit store floating point value of 64.5.

2. Char

Data types that holds character such as ‘a’, ‘b’, ‘C’ etc.

char hamrocsit = 'Y';

Here variable hamrocsit store character ‘Y’.

Source: https://codehelppro.com/detail/c-programming/data-types/

If you found any type of error on the answer then please mention on the comment or report an answer or submit your new answer.
Leave your Answer:

Click here to submit your answer.

  Loading . . .