i have pointer of array(array which is in memory). Can i calculate the size of array from its pointer ? i dont know actually where is the array in memory. i only getting poi
No. arrays in C doesn't have this info. you should hold a variable "next" to the array with this data.
if you have the array it self you can use the sizeof to get his size in compilation stage.
char array1[XXX];
char* pointer1 = array1;
sizeof(array1); // this is XXX
sizeof(pointer1); // this is the size of a pointer in your system
you should do the following and use the variable in you program (or pass it to function when you passing the array to a function)
int array1size = sizeof(array1);