Hello Viewer! how are you? I hope you are very well. Today I have learned about Data Types and User-Defined Data Types. below I have written what I learn today...
DATA TYPES?
- As the name suggests "DATA TYPES" means "what type of data is" -- the type of data - integer, character, strings, float, boolean etc.
- In Programming data type tells us one more very important thing that is "WHAT TYPE OF OPERATIONS WE CAN PERFORM ON THAT".
OR
- Datatype is used to declare/define a variable(variable are like container in memory that contains some value). datatype specifies the datastore format for the variables.
- ex - char A, int b etc.
Two Important Things About DataTypes
- Defines a certain "Domain" of values.
- Define a certain "Operations" allows on these values.
- 1. "Domain" is something that tells which type of data (like integer, float, character etc) we are dealing with.
- 2. "Operations" defines which type of operation we can perform on that type of DATA.
For Example
(a) If we take Data Type as an "Integer" then operations that we can perform on that data are :-Addition, subtraction, multiplication, division, bitwise, modulo(%) etc.Almost every type of operation we can perform on "Integer" data type. but if in case of example 2 👇
(b) If we take Data Type as a "Float" then operations that we can perform on that data are :-Addition, subtraction, multiplication etc. (But we can not perform "Modulo(%)" , "Bitwise" opearion on that).
Similarly, we can not perform the multiplication operation of Characters, strings etc. THIS IS THE IMPORTANT THING ABOUT DATA TYPES. {I hope you will get the things that I want to explain}.
NOTE:Integer, Float, Character etc all of these are "Primitive Data Type".Primitive Data Types are specified in the language own.
Now, the Next Topic is "User-Defined Data Types"
- In context to Primitive Data Type, there is a concept of "User-Defined Data Type".
- The Operation and Values of "User-Defined Data Type" are not specified in the language itself but is specified by the user.
Example:
Structure, Union and Enumeration
Structure Syntax:-
struct point{int x;int y;};
- By using the structure we are defining our own types by combining other data types.
{That's All for Today. I hope you liked it. we will discuss more in upcoming posts}
THANKS FOR READING! 💗💗 If you found any error or missing something then Don't forget to ping me or Mail Me.