How to return a vector inside a function? And what do I call it in the main?
This return in case: (return vector;)
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
float UK (int mat[4][4], float w[3]){
float *vetor[4];
float res = 0;
for(int l=0; l<4; l++){
//printf("\n");
float soma = 0;
for(int c=0; c<3; c++){
//printf("%tfd ", mat[l][c]);
res = mat[l][c] * w[c];
printf("Resultado: %f\n", res);
soma = soma + res;
}
*vetor[l] = soma;
printf("Vetor: %f\n", vetor[l]);
}
return vetor;
}
float *Limiar(float vet[]){
for(int c=0; c<4; c++){
if(vet[c] >= 0)
vet[c] == 1.0;
else
vet[c] == 0.0;
}
printf("Yl: %d", vet);
return vet;
}
float Delta(){
}
int main () {
int mat[4][4];
float w[3];
mat[0][0] = -1;
mat[0][1] = 0;
mat[0][2] = 0;
mat[0][3] = 0;
mat[1][0] = -1;
mat[1][1] = 0;
mat[1][2] = 1;
mat[1][3] = 0;
mat[2][0] = -1;
mat[2][1] = 1;
mat[2][2] = 0;
mat[2][3] = 0;
mat[3][0] = -1;
mat[3][1] = 1;
mat[3][2] = 1;
mat[3][3] = 1;
w[0] = 0.2;
w[1] = 0.2;
w[2] = 0.2;
Limiar(UK(mat, w));
return 0;
}