Question: Before we begin the chapter, let's review and practice C language coding: Implement a main program and the following functions in C. You may use
Before we begin the chapter, let's review and practice C language coding:

Implement a main program and the following functions in C. You may use floats or doubles for floating-point valued variables. (a) Create a C source file called vector.c. (b) Define a struct named Vector, a new C data type for 3-vectors, using stack arrays. (c) Write the following functions, which must take Vector, by pointer, for their vector arguments. Func- tions should return 0 if they run successfully and 1 if they produce an error. i. initialize: initialized the provided vector to o ii. inner-product: returns the inner (dot) product of two vectors iii. norm: returns the Euclidian norm of a vector iv. normalize: modifies a given vector to have length1, in place v. axpy: returns the result of the operation w = a*u + v vi. print: prints the contents of a vector in a useful way (d) Write a main program that uses the above functions (e) Compile your program so that the binary executable is named vector_01
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
