I'm having some trouble working with passing around arrays of floats. I throw some arrays of floats into the ActivationFunc, and then from there I throw those same arrays into the sgnFunction, which for some reason ends up having different values.
#include <stdio.h>
void sgnFunction(float *input[], float *weight[])
{
printf("VALUES: %.2f %.2f %2.f, WEIGHTS: %.2f, %.2f, %.2f\n", *input[0], *input[1], *input[2], *weight[0], *weight[1], *weight[2]);
}
void ActivationFunc(float *x, float *w, float *n, int *d)
{
printf("VALUES: %.2f %.2f %2.f, WEIGHTS: %.2f, %.2f, %.2f\n", x[0], x[1], x[2], w[0], w[1], w[2]);
sgnFunction(&x, &w);
}
int main()
{
float x1[3] = {1, 0, 1};
float x2[3] = {0, -1, -1};
float x3[3] = {-1, -0.5, -1};
int d[3] = {0, 1, 1};
float w[3] = {1, -1, 0};
float n = 0.1;
ActivationFunc(x1, w, &n, &d[0]);
}
If I remove the '&' from "sgnFunction(&x, &w);", I get a compiler error of:
test.c: In function 'ActivationFunc':
test.c:10:9: warning: passing argument 1 of 'sgnFunction' from incompatible pointer type
test.c:2:14: note: expected 'float **' but argument is of type 'float *'
Which I don't understand what it means to fix it. I know I'm probably just screwing something up with my use of pointers. A nice explanation of what's wrong, what I'm doing wrong with my pointers, and how to fix this would be greatly appreciated.