In the following snippet, pointer addresses and values are referenced as the type size_t
.
However as the title says, the last subtraction does not make sense to me. It acts like, as if it subtracts the number multiplied with 8 instead of the actual value as seen in the int array
.
#include <stdio.h>
#include <stdint.h>
int main()
{
int i[6] = {2, 0, 1, 0, 20, 24};
void *ptr = &i[2];
printf("%zu\n", ((size_t*)ptr));
printf("%zu\n", *((size_t*)ptr));
printf("%zu\n", ((size_t*)ptr) - *((size_t*)ptr));
}