1. Write the definition of a function printArray , which hastwo parameters. The
ID: 3615719 • Letter: 1
Question
1. Write the definition of a function printArray , which hastwo parameters. The first parameter is an array of int s andthe second is an int , the number of elements in the array.The function does not return a value. The function prints out eachelement of the array, on a line by itself, in the order theelements appear in the array, and does not print anything else.2. Assume that an array of int s named a has beendeclared with 12 elements. The integer variable k holds avalue between 0 and 6. Assign 15 to the array element whose indexis k .
Explanation / Answer
please rate - thanks #include #include using namespace std; void printArray(int[],int); int main() {int a[12]={4,5,6,7,8,9,3,4,5,6,4,5}; int i=12,k; printArray(a,i); do{printf("Enter index to change( between 0 and 6): "); scanf("%d",&k); if(k6) printf("invalid entry "); }while(k6); a[k]=15; //part b printArray(a,i); getch(); return 0; } void printArray(int a[],intn) //part a {int i; for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.