Dynamic size



  • Dun is a dynamic body. How do you know his size?



  • If a dynamic mass means an index initialized by the type code

    int* array = new int[42];
    

    No way.

    In some exercises, the size can be challenged https://msdn.microsoft.com/en-us/library/z2s077bc.aspx /msize/malloc_size, but the standard does not specify:

    #include <malloc.h>
    

    int main()
    {
    int *arr = new int[42];
    int length = _msize(arr) / sizeof(int); // 42!

    return 0;
    

    }


Log in to reply
 


Suggested Topics

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