I have written a function definition to get the scalar multiplication for a vector. I was given a prototype to work with but am having confusion with understanding pointers in this. here is the prototype.
void scalar_mult(double k, const threeVec_t *src, threeVec_t *dest);
// REQUIRES: src and dest point to threeVec_t objects.
// PROMISES: *dest contains the result of scalar multiplication
// of k and *src.
struct threeVec {
double x;
double y;
double z;
};
typedef struct threeVec threeVec_t;
and here is my code, what am I doing wrong?
void scalar_mult(double k, const threeVec_t *src, threeVec_t *dest)
{
int i, j, result;
for (i = 0; i < src; i++) {
for (j = 0; j < dest; j++) {
result[i][j] = k * result[i][j];
}