I've built a class called IntSet. My problem is that i dont want to storage another element that is the maximum amount of elements i want to introduce in elem array. So, in add method or any other method, i want to find out the max size i've allocated in the IntSet (int dim_max) constructor using this operation : 
int n = sizeof(elem) / sizeof(*elem); //or sizeof(elem) / sizeof(int);
cout << "N is = " << n;
However, this doesnt work, everytime n is 1, even if i allocate  elem = new int[dim_max];, where dim_max is a variable i read from the keyboard and it's much bigger than 1. Here is the code :
 #include <iostream>
using namespace std;
class IntSet{
    int *elem;
    int dim;
    public:
    IntSet (int dim_max) {
        dim = -1;
        elem = new int[dim_max];
    }
     void add(int new_el) {
        int n = sizeof(elem) / sizeof(int);
        cout << "N is =" << n;
        for(int i = 0; i < n; i++) {
            if(elem[i] == new_el) {
                cout << "It's already there !";
                return;
            }
        }
        dim++;
        if(dim == n) {
            elem = (int*)realloc(elem, sizeof(int) * (n + 1));
            global_var++;
        }
        elem[dim] = new_el;
     }
};
 
     
     
     
    