0
#include<stdio.h>
#include<stdlib.h>
#define tamanho 5
struct test {
int vetor5;
}casa[tamanho];
//funcão para o vetor da struct
void recebe (void) {
for (int p=0; p<tamanho; p++) {
printf("| %d",casa[p].vetor5);
}
}
int main (){
//INICIALIZANDO VETOR DA STRUCT
for (int i=0; i<tamanho; i++) {
casa[i].vetor5=0;
}
recebe();
for(int y=0 ; y<tamanho; y++) {
//insiro os valores
printf("\nInsira um novo valor para a struct:");
scanf("%d", &casa[y].vetor5);
}
return 0;
}
The problem is unclear. You want to dynamically increase/decrease the vector size?
– Mauro Roberto
The size remains the same. It would be like the vector is all 0. When I enter any number, it is updated in real time. Going to display the new number informed, along with the others.
– Emerson Oliveira
I don’t know if I understood but isn’t it just a matter of printing (via function receives) the vector after the vector update? In fact, it’s a strange name for a function that only prints.
– anonimo
Maybe it doesn’t even have to be via function. But what I’m trying to do is that the vector, it stays on display while informing the new entered data.
– Emerson Oliveira
can’t understand what you want...
– zentrunix