can't understand what this means "the data type defines the use of an identifier" since the identifier is what help us to access a variable In memory instead of using it's adress memory. am I missing something? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

can't understand what this means "the data type defines the use of an identifier" since the identifier is what help us to access a variable In memory instead of using it's adress memory. am I missing something?

11th Jul 2016, 9:03 PM
zak
4 Answers
+ 4
It means that the operations you can do with a certain identifier (name of a variable) depends of the data type. For example, you cannot use operator& with non-integer primitive types unless you overload it. Another example is that the methods you create in a user defined type can be used only within that newly created data type, or within a derived class, if you create inheritance.
11th Jul 2016, 9:33 PM
Garme Kain
Garme Kain - avatar
+ 2
thanks @Garme Kain. I went to cplusplus.com and they said that a variable is a portion of memory to store a value, an the identifier is what help us to access it, I think in the tutorial they wanted to make things simple for beginners with that definition, and that disturbed me a little since I have studied a little bit C and understood that notions earlier. I thought that was different in c++ and according to your answer and what I found, it's clearest now. I think, a more appropriate definition in my case would be "a data type defines the use of variables instead of "idetifier" , since the identifier is just a reference to the variable :)
11th Jul 2016, 9:48 PM
zak
+ 1
The identifier of something is just its name.
11th Jul 2016, 9:52 PM
Garme Kain
Garme Kain - avatar
0
awesome u both Zak sir and Garme sir
18th Jul 2016, 8:13 AM
meherDev
meherDev - avatar