Lab 2 (10 Points)

$24.99 $18.99

Objectives: Review call-by-reference Review basic array operation Review basic for-loop operation Description: Implement a function, called sumArray, that computes the sum of a given integer array, and stores the sum into an integer pointer. The function will take an integer pointer for the sum of the array, an integer array for the values to be…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:
Tags:

Description

5/5 – (2 votes)

Objectives:

  • Review call-by-reference

  • Review basic array operation

  • Review basic for-loop operation

Description:

Implement a function, called sumArray, that computes the sum of a given integer array, and stores the sum into an integer pointer. The function will take an integer pointer for the sum of the array, an integer array for the values to be added, and an integer for holding the array size. Lastly, print out the sum in the main function.

Every user-defined function must have a comment describing:

  • What function does;

  • What parameter values are;

  • What value it returns.

Function Prototype:

  • void sumArray (int* sum, int inputArray[ ], int size);

Example output:

  • gcc sum_A.c -Wall -Werror

  • ./a.out

The sum of the given array is 104.

Grading Criteria:

Main function:

4 points

sumArray function:

4 points

Comments:

2 points

Note:

  • If your code does not compile with –Wall and –Werror, you will receive a zero for this assignment.

  • You need to finish at least three peer reviews within three days of this lab. Otherwise, you will get a 20% penalty.

  • You will lose points if you don’t have enough comments.

1

Lab 2 (10 Points)
$24.99 $18.99