Answer to Question #73336 in C++ for kon

Question #73336
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.code plz
1
Expert's answer
2018-02-12T07:36:38-0500
#include <iostream>

using namespace std;

const int SIZE = 10;

void arrIncrement(int* arr){
for(int i = 0; i < SIZE; ++i){
arr[i]++;
}
for(int i = 0; i < SIZE; ++i){
cout << arr[i] << " ";
}
cout << endl;
}

int main(){

int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
arrIncrement(arr);

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS