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.

    BOOL,BOOLEAN,BSTR,BYTE,CHAR,DOUBLE,DWORD,DWORD_PTR,DWORD32,DWORD64,DWORD,LONG,FLOAT,HANDLE,HCALL,HRESULT,INT,INT8,INT16,INT32,INT64
    

    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

    int a;
    

    for variables a memory is either static or automatic, depending on where the variable is declared.

    That's exactly what happens with this announcement.

    int *b;
    

    The difference is that for change a The permissible values are the whole numbers of the type intfor variables b - the values of the addresses of the objects of the whole type, i.e. the type int *

    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 b

    Difference between the two proposals

    b = &a; 
    b = new int;
    

    It is only that in the first case the variable is b you 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. b

    With regard to announcements such as

    BOOL,BOOLEAN,BSTR,BYTE,CHAR,DOUBLE,DWORD_PTR,DWORD32,DWORD64,DWORD,LONG,FLOAT,HANDLE,HCALL,HRESULT,INT,INT8,INT16,INT32,INT64

    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. char can act like signed char or unsigned char♪ To avoid such ambiguambiguity, alas has been introduced. BYTEwho acted, for example, equivalent to the type unsigned char

    All of these alias were introduced to avoid ambiguguity in the code by introducing specific characteristics of the types, such as discharge, character, etc.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2