0
The function only returns me the memory address, how do I make it return the content and not the memory address?
#include <iostream>
#include <time.h>  ///  por causa de srand()
#include <stdlib.h>   // para poder gerar os pesos aleatorios ou pra poder usar o rand()
#include <vector>   /// vector que armazenara os meus neuroneos
#include <deque>
#include <iomanip>   // por causa do setw()
int* pes;
void funcaoGerarPesos(){   /// sempre por referencia
    int colunas = 10;
    /// lembre-se que o numero de pesos é sempre igual ao tamanho de exemplo de treinamento
    for (j = 0; j < colunas; ++j)
    {
        srand(time(NULL));     //// responsavel pela geracao automatica
        peso_aleatorio = (rand() % 6) + 1;    //// armazenar o valor gerado na variavel valor_treinamento
        pes = &peso_aleatorio;    //// o meu ponteiro apontara para o valor contido na variavel peso_aleatorio
        vector_pesos.push_back(pes);    //// pegar todos os valores gerados e colocar no vector de pesos
    }
    //// percorrer com o while
    it = vector_pesos.begin();
    while(it != vector_pesos.end()){
        cout << *it << endl;
        it++;
    }
}
int main(int argc, char *argv[]){
    funcaoGerarPesos();
}
Hello, the function only returns to me the memory address, as I do that it returns to me the content and not the memory address, I would appreciate if someone could help, any help will be welcome, thanks since
– Antonio Goncalves
Please edit your question to include in it that explanation you provided in comment. Also include other things that are missing, for example: (1) where your variable is declared
vector_pesos? (2) Why are you adding in the vector a pointer and not the value directly? (3) Why didn’t you make your function directly return avector<float>instead ofvoid?– Luiz Vieira