我在数据结构问题上遇到错误,无法识别

I was getting a error on data structure question and unable to identify

问题是{WAP演示动态内存分配的malloc(),calloc()和realloc()函数}

Source Code-

#include<iostream>
#include<stdlib.h>
using namespace std;
int  main()
{
  int n,i,*p,n1;
  char ch;
   cout<<"Enter total elements ";
   cin>>n;
   p=(int*) malloc (p*sizeof(int));
   /* p=(int*)calloc(p,sizeof(int)); */
   if(p==NULL)
   {
     cout<<"Memory allocation failed\n";
     exit(1);
   }
   for(i=0;i<n;i++)
   {
     cout<<"Enter the element ";
     cin >> *(p+i);
   }
   for(i=0;i<n;i++)
   {
     cout<<*(p+i);
   }
   cout<<"Enter new size ";
   cin>>n1;
   p=(int*)realloc(p,sizeof(int));
   if(p==NULL)
   {
     cout<<"Memory allocation failed\n";
     exit(1);
   }
   for(i=n;i<n1;i++)
   {
     cout<<"Enter the element ";
     cin >>*(p+i);
   }
   for(i=0;i<n1;i++)
   {
     cout<<*(p+i);
   }
   free(p);
   return(0);
}

Error code line according to visual studio code

p=(int*) malloc (p*sizeof(int));

Error Message, I was getting-

表达式必须具有算术或无范围枚举类型

p*sizeof(int)

你应该将 sizeof(int) 和一些数字相乘,而不是 'p' - 指针值。

int size = 20; 
p=(int*) malloc (size * sizeof(int));