Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Questions about duplicating an array

$
0
0
I do not know what means or how to solve it

Here is the Question :

Write function duplicate( int x[],int s) that receives an array of integers, and its size. the
function duplicates all array elements. In the main, let user enters an array of 5 elements, call the
function, then print out the array after calling the function.



here is what i wrote, but it is wrong , since we need one array and it's size in function
#include<iostream>
using namespace std;
int duplicate(int x[],int s)
{
#include<iostream>
using namespace std;

int Duplicate(int x[], int Copyarray[], int s)
{
int i;

for(i=0; i<s; i++)
Copyarray[i] = x[i];

return 1;
}
}




any hint what question mean? does it mean that mean if size is 5 i increase it to 10 ?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>