i have encountered these "X_t" types many times in c programs,what does they really mean?where is the location of these definition?
The _t
suffix means "type"; it's not a rule that you have to use it, it's just a convention followed by a lot of standard types from the standard libraries. They're usually defined in the header files that use them, or sometimes in header files included by those headers.
size_t
is defined in <stddef.h>
, and time_t
is defined in <time.h>
. key_t
is not a standard C type, so it's probably defined in the library header for whatever library it's used in.
If you want to know exactly which header file a definition came from, you can run the preprocessor:
gcc -E file.c -o file.i
The preprocessor output file.i
will show you all of the nested include files. You can then search it for the definition, then scroll upwards until you find the comment that indicates which header file it came from.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With