How to dynamically allocate an int in C++

1 Answer

0 votes
#include <iostream>
 
int main()
{
	int *p = new int;
	
	*p = 837;
	
	std::cout << *p;
	
	delete p;

	return 0;
}
 
  
  
/*
run:
  
837
  
*/

 



answered Dec 11, 2020 by avibootz

Related questions

...