Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer asap in C please Proper Submission [1 mark]: Modify the provided lab3.c appropriately and submit two files named lab3.c and lab3.txt to the

image text in transcribed

image text in transcribed

please answer asap in C please

Proper Submission [1 mark]: Modify the provided lab3.c appropriately and submit two files named lab3.c and lab3.txt to the lab 2 submission form on Blackboard. Your lab3.c file should be a properly-indented file that correctly compiles. Your lab3.txt should be a plain text file. At the top of lab3.c include your name and cite any outside sources that you used while working on this lab. This constitutes signing a statement of academic integrity and submitting a false statement is grounds for academic penalization. Part 1: Coding [10 marks). Matrices are rectangular arrays of numbers that have many applications in science, mathematics, and engineering. Each entry in a matrix has a row index and a column index typically denoted by two subscripts. For example, the matrix 110,0 20,1 20.2 01.0 011 01.2 : : an-1,0 An-1.1 an-1.2 has n rows (indexed by an integer from 0 to n - 1) and 3 columns (indexed by an integer from 0 to 2) and is said to be an n x 3 matrix. In C, matrices can be stored as a two-dimensional array. For example, the declaration int a[n][3]; allocates enough memory to store an n x 3 matrix. During the lab, the assistants will go over multi-dimensional arrays and how to implement a function matrix_equals that tests if two given matrices are equal (note that arrays cannot be compared for equality using the == operator). They will describe how array elements can be accessed either using indexing (the [] operator) or using pointer arithmetic. The sum of two matrices of the same size can be formed by adding together the entries that appear in the same locations (i.e., entrywise addition). Complete an implementation of the following prototype for a function that computes matrix addition. W matrix_add(n, a, b, c) computes the sum of the n x 3 matrices a and b; the result is stored in the n x 3 matrix c // requires: n >= 1 void matrix_add (const int n, const int a [][3], const int b[][3], int c[] [3]); Next, complete implementations of the following two functions which perform the matrix operation that is stated in the function purpose statements. In the implementation of negate_row you cannot use the indexing operator [] and must instead use pointer arithmetic. // negate_column (n, c, a) negates the entries in column c of the n x 3 // matrix a W requires: n >= 1, 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago