In C, you must use struct
prefix when declaring a variable with a struct type.
In C++, it's not required to prefix with struct
.
Since you have tagged this as a C++ question, I assume you are using a C++ compiler and so you do not get a compiler error when you use timeval
without the struct
prefix. However, if you were to use a C compiler, it would issue an error.