Dynamic Vector + Dynamic Allocation

Asked

Viewed 92 times

1

Good afternoon, I would like to know how to create a dynamic vector in C, to store the following information:

host(on, off, broken) | time_total_status

to display on the screen, as if it were a table. Ex: on | 120.000000 sec stop | 230.000000 sec

And then tell everything to show the total of states.

I don’t even know where to start, and I want to try. Thank you.

  • 1

    I didn’t understand what the relation of that is that you want (state of the machine and time in the states) with things relating to vectors and dynamic allocation. It seems to me that you are simply thinking of a kind of solution that has little or no relation to your problem, and so you get nowhere. What you’re asking for is something more or less "how to stack bricks to make watermelon juice?", a question that makes no sense.

1 answer

1

If I understand what you want to do right, I suggest using struct.

It would look something like this:

struct meuVetorDinamico {
    char estado[20];
    float tempoEstado;
    float tempoTotal;
} algumAliasAqui;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.