determine distance c++ array programmatically?
this doubt fervent identical question:
my doubt small different: is there any proceed establish distance c++ array programmatically? not, why? each duty i've seen takes an array also requires an integer parameter give size. nonetheless related doubt separate out, delete[] contingency know distance memory deallocated.
consider c++ code:
int* arr = new int[256];
printf("size arr: %d\n", sizeof(arr));
this prints "size arr: 4", only distance pointer. good have duty prints 256, nonetheless i don't cruise exists c++. (again, biased doubt since doesn't exist.)
clarification: i know i announced array smoke-stack instead store (i.e. "int arr[256];") sizeof user relapse 1024 (array length * sizeof(int)).
Comments
Post a Comment