#include <stdio.h>

size_t sizeof_func(const void *ptr);

int main() {
    int x = 10;
    size_t size = sizeof_func(&x);
    printf("The size of x is %zu bytes\n", size);
    return 0;
}

size_t sizeof_func(const void *ptr) {
    const char *p = ptr;
    size_t size = 0;
    while (*p++) {
        size++;
    }
    return size;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: