Difference of data types and declaration of variable from primary indicator
I'd like to understand, because with a couple of types on this list, I ran into the MSDN sketch, of course.
What do they deceive or differ from what they say?
int, long int, short int, char итд, except for the register or any difference? Then what's the point?
Let's say there's a code like this:
int a; a = 10; int *b; b = new int; *b = 10;
Everything in the code is valid, just if I didn't read badly, I didn't catch the idea why we were writing a line for the indicator.
b = new int;? Why don't we write the same for the normal variable?
I'm sorry pardoning you for such, banal questions.
When you write
amemory is either static or automatic, depending on where the variable is declared.
That's exactly what happens with this announcement.
The difference is that for change
aThe permissible values are the whole numbers of the type
b- the values of the addresses of the objects of the whole type, i.e. the type
You can write.
a = 10;
And you can also write
b = &a;
I mean, it's totally identical.
With regard to this proposal
b = new int;
it consists of several operations. First, the dynamic memory creates a type object
intand then the address is assigned to the variable
Difference between the two proposals
b = &a; b = new int;
It is only that in the first case the variable is
byou assign the address of the already named object, and in the second case
выFirst, you create an unnamed object in dynamic memory, and then you assign a variable address.
With regard to announcements such as
You should consider that, for example, C does not have a buoy type. It was therefore usually replaced by either a whole type or a list.
Or, like, a type.
charcan act like
unsigned char♪ To avoid such ambiguambiguity, alas has been introduced.
BYTEwho acted, for example, equivalent to the type
All of these alias were introduced to avoid ambiguguity in the code by introducing specific characteristics of the types, such as discharge, character, etc.