#include<iostream>
using namespace std;
int main()
{
int i= new int;
cout<<i;
return 0;
}
when I tried to assign an int value I for its heap
Error: invalid conversion from 'int *' to 'int'
when I assign a value to an int pointer, then it assigns a value to it. Why can't we assign an int value to heap.Yes I know as much as possible without assigning a value to the heap. I looked at a lot of stackoverflow posts that all explained about int * p = new int [10]; Please someone explain this to me. Thank you for your help.
source
share