C and C++ compilers implement several sizes of integer (typically 1, 2, 4, and 8 bytes {8, 16, 32, and 64 bits}), but without some helper code to preform arithmetic operations you can't really make arbitrary sized integers.
The declarations you did:
int *ptr;
ptr = (int *)malloc(10);
Made what is probably a broken array of integers. Broken because unless you are on a system where (10 % sizeof(int) ) == 0)
then you have extra bytes at the end which can't be used to store an entire integer.
There are several big number Class libraries you should be able to locate for C++ which do implement many of the operations you may want preform on your 10 byte (80 bit) integers. With C you would have to do operation as function calls because it lacks operator overloading.
Your sizeof(ptr)
evaluated to 4 because you are using a machine that uses 4 byte pointers (a 32 bit system). sizeof
tells you nothing about the size of the data that a pointer points to. The only place where this should get tricky is when you use sizeof
on an array's name which is different from using it on a pointer. I mention this because arrays names and pointers share so many similarities.