Program for new and delete operator in C++
#include<iostream>
#include<string>
using namespace std;
int main()
{
char *x;
x=new char
cout<<"enter string ";
cin>>x;
cout<<"\nentered string is"<<x<<endl;
delete x;
return 0;
}
output:
enter string asdfdg
entered string is asdfdg
Comments
Post a Comment