Code:
print_vector( v ) vector v;
Code:
float sum( x ) vector x;
like
return_type function_name(input parameters_type input_parameter)
what is the purpose of this extra thing given after this normal syntax.
And sometimes 2 things are given not just one " vector x, y"
Code:
float scalar_mult( x, y ) vector x, y;
{
int i;
float s = 0.0;
for ( i = 0 ; i < NUM ; i++ ) s += ( x.p[i] * y.p[i] );
return s;
}
Code:
#include <stdio.h>
#define NUM 2 /* Number of input nodes */
#define LIMIT 100 /* Maximum number of inputs the system can handle */
#define SESSIONS 3000 /* Number of training sessions that we'll put the system through */
typedef struct
{
float p[NUM]; //Input vector
} vector;
vector w, test[LIMIT];
int hits[LIMIT], total;
float bias = 0.5;
print_vector( v ) vector v;
{
int i;
for ( i = 0 ; i < NUM ; i++ ) printf(" %.4f ", v.p[i] );
printf("\n");
}
float sum( x ) vector x;
{
int i;
float s = 0.0;
for ( i = 0 ; i < NUM ; i++ ) s += x.p[i];
return s;
}
