void * ptr0 = (void*)"Buffer_1";
int size0 = sizeof(ptr0);
// WILL THIS RETURN THE NUMBER OF BYTES OCCUPIED BY THE MEMORY POINTED BY ptr0?
My requirement is
1) store some data in buffer & create a void* pointer to it which I am doing in 1st line.
2) Later I want to get the size of this buffer in BYTES. The 2nd line will do this job.
sizeofreturns the size required by the type. Since the type you pass tosizeofin this case is pointer, it will return size of the pointer.If you need the size of the data pointed by a pointer you will have to remember it by storing it explicitly.