I'm doing dynamic memory allocation testing, but when I try to get the size of the array I always have the same result.
int main()
{
int *teste=malloc(sizeof(int) * 10);
int len=sizeof(teste) / sizeof(int);
print("%i\n", len);
return 0;
}
Compiling with gcc:
bash-4.2$ ./teste
2
It does not matter if I put sizeof(int) * 100
or 10
, it always returns 2 :(
What am I doing wrong?