Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
append
//g++ 7.4.0 //write a function that appends first n elements of array b onto the end of the first m elements of array a. Make sure array a has room for at least m+n elements; //this code is created by Rezaul Hoque on June 14,2021; contact: jewelmrh@yahoo.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; #include <iostream> using namespace std; int size =9; int m=5, n=2; void append(int [], int , int [], int); void append(int a[], int m, int b[], int n){ int i; for (i=0;i<n; i++) a[m+i]= b[i];//append n elements of b at the end of a, starting from index m ; so when i= 0,a[m]; when i=1, a[m+1]... for(i=0;i<size;i++) cout<<" "<<a[i]; } int main () { int a[size]={1,2,3,4,5,0,0,0,0};//size of array a must have ample room so that we could put the elements of b at the end of it; for this reason , rest of the elements of array a are filled with 0 int b[n]={6,7}; append(a,5,b,2); return 0; }
run
|
edit
|
history
|
help
0
Camel case
articulation points (http://codeforces.com/contest/732/problem/F)
OverloadFunc
DeltaX campus recruitment
kth smallest element in a matrix
23 2.5
simple use of templete
Overland pg. 68
Test
Test 13(2020)