Computer Science, asked by ZoomSTER8540, 8 months ago

What is different between Data type and variable

Answers

Answered by kdtavleen86
0

Answer: THE MEMORY REQUIRED BY THE VARIABLE IS DEFINED BY ITS DATA TYPE.

For eg.

'x' is a variable.

'int' is a data type. 'int' is the keyword for integer. Integer means number which dont have fractional part.

Now,

int x;

Variable x will require 2 bytes to get stored. Because storage REQUIRED by its data type that is int is 2 bytes.

float x;

Variable x will require 4 bytes to get stored. Because storage REQUIRED by its data type that is float is 4 bytes.

Floating point is a real number. float is a keyword used for it.

Similar questions