69 670
Assignments Done
Successfully Done
In February 2019

Answer to Question #73318 in C++ for Sani

Question #73318
Initialize an integer array of size 10; pass it to a function ‘arrIncrement’ using a pointer. The function should increment all elements of the array by one. Then display the updated array on screen.Give me code of this in c++
Expert's answer
#include <iostream>
#include <stdlib.h>
#include <ctime>
using namespace std;
void arrGenerate(int *a, int size)
for (int i = 0; i < size; i++)
a[i] = rand() % 100;
void arrPrint(int *a, int size)
for(int i=0; i<size; i++)
cout<<a[i]<<' ';
void arrIncrement(int *a, int size)
for(int i=0; i<size; i++)
int main(int argc, char** argv)
const int N=10;
int arr[N];
arrGenerate(arr, N);
arrPrint(arr, N);
arrIncrement(arr, N);
arrPrint(arr, N);
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions