#include<iostream>
#include<malloc.h>

using namespace std;

template <class T>
class SearchingClass
{
    public :
         void searchData();
         void createArray(int arrSize);
    private :
        T arr[];
};

template <class T>
void SearchingClass<T> :: createArray(int arrSize)
{
    cout << "Enter the "<< arrSize << " elements one by one : "<<endl;
    int element;

    arr = (T*) malloc(arrSize * sizeof(T)); //Error pops up here
    for(int i = 0; i<arrSize ; i++)
    {
        cin >>element;
        arr = element;
    }

}

int main()
{
    SearchingClass<int> scObj;
    cout << "Please enter the size of the array : " << endl;
    int arrSize;
    cin >>arrSize;
    scObj.createArray(arrSize);
    return 0;
}