#include
#include
#include
#include
using namespace std;
//function to return an array
int *funToReturnArray()
{
int *ret = new int[10];
for (int i=0; i<10; i++){
ret[i]=i;
}
return ret;
}
//function to return an array
int funToReturnArrayTest()
{
int *ret = new int[10];
for (int i=0; i<10; i++){
ret[i]=i;
}
return *ret;
}
char * CopyToDestination(char Src[], char Desc[], size_t size)
{
char *newDestination = new char[19];
for (int i=0; i
newDestination[i] = Src[i];
}
return newDestination;
}
void main()
{
//Returning the array from function.................
int *arr=0;
arr = funToReturnArray();
for(int i=0; i<10;i++)
cout<
delete [] arr;
char *source="Source";
char *destination="";
//Source and Destination example...
char* retDestination= CopyToDestination(source, destination, 12 );
for(int i=0; i<12;i++)
cout<
delete[] retDestination;
}
#include
#include
#include
using namespace std;
//function to return an array
int *funToReturnArray()
{
int *ret = new int[10];
for (int i=0; i<10; i++){
ret[i]=i;
}
return ret;
}
//function to return an array
int funToReturnArrayTest()
{
int *ret = new int[10];
for (int i=0; i<10; i++){
ret[i]=i;
}
return *ret;
}
char * CopyToDestination(char Src[], char Desc[], size_t size)
{
char *newDestination = new char[19];
for (int i=0; i
newDestination[i] = Src[i];
}
return newDestination;
}
void main()
{
//Returning the array from function.................
int *arr=0;
arr = funToReturnArray();
for(int i=0; i<10;i++)
cout<
delete [] arr;
char *source="Source";
char *destination="";
//Source and Destination example...
char* retDestination= CopyToDestination(source, destination, 12 );
for(int i=0; i<12;i++)
cout<
delete[] retDestination;
}