0

If I have the structure and I want to have an array of requests to type so then for example, I can use like type->x and type->y. How can I implement it?

typedef struct
{
    int id;
} Test;

I appreciate any explanation.

EDIT: I change the name of variables to make it a clear that I will not use time library.

nas2016
  • 15
  • 5

1 Answers1

0

you can use time.h library

https://www.tutorialspoint.com/c_standard_library/time_h.htm

for code for a timer see How to use timer in C?

the elements of your struct are then of type time_t or clock_t update :

you mean what a struct is...

basically a structure is acollection of data that is internally / logically related and the struct ensures that it is stored as a block in memory

the elements of a structure can either be variables or pointers to variables

the structure as a whole can also be accessed either as pointer or as variable

to access elements of a struct as variable use the .

to access elements of a struct as pointer use the ->

foo->bar is equivalent to (*foo).bar, i.e. it gets the member called bar from the struct that foo points to.

Arrow operator (->) usage in C

https://www.tutorialspoint.com/cprogramming/c_structures.htm

ralf htp
  • 9,149
  • 4
  • 22
  • 34