Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C Program: Write a main program to declare an integer array of size 3 and initia

ID: 3911012 • Letter: C

Question

C Program:

Write a main program to declare an integer array of size 3 and initialize it with 1, 2 and 3. Pass this array to a function called change. The function has two parameters one is the array and the other is the size of the array. The function should only use pointer notations and it should multiply each item of the array by 2 (using pointer notations). A second function called printArray should also accept two parameters one is the array and the other one is the size. This function should display the values of the array. Main program should test both functions. Also make sure to use the principle of least privilege for the printArray function.

Explanation / Answer

#include<stdio.h>

//main body of the program

int main()

{ int i=3;

int arr[i] ;

//initializing array elements

arr[0] = 1;
arr[1] = 2;
arr[2] = 3;

printArray( arr[ ] , i)

}

//function to multiply the values by 2

//function to print the updated values

void printArray(int arr,int i)

{

  for(int j = 0; j< i ; j++)

}