6
For example, I have the statement of the following vector:
float vet[3] = {1, 1, 1};
It would be possible to change all values of the same at once, without having to change one by one element or create a new vector and assign it to it:
vet[0] = -1;
vet[1] = 0;
vet[2] = 1;
Something more or less like this:
vet = {-1, 0, 1};
In my case this is the most appropriate, because I have to change the value of the vector tens or hundreds of times. I created the function
void createVector(float *vet, float e1, float e2, float e3) {
 vet[0] = e1;
 vet[1] = e2;
 vet[2] = e3;
}
– Leonardo
There it makes sense, although the syntax shouldn’t be this.
– Maniero
Should it be like? Without the pointer? If that’s what I took, I was doing some tests here then I forgot to change to
float vet[3]
kk– Leonardo
That’s right. There are other ways to do it, but if it suits you, it’s suitable.
– Maniero