When is it really used ? Can I use it as a substitute to int ? For eg. I have a datastructure :
But the problem here is that nvert and ntri should be unsigned and I want to set an upper limit of may be a billion on both of them. Is it permissible to use size_t in this case ? Or should I use unsigned long. what is format specifier for size_t. Is it %lu ?
int nvert; /* Number of vertices */
int ntri; /* Number of triangles */
vector *vert; /* List of vertices, size is nvert */
triangle *tri; /* List of triangles, size is ntri */
Do you usually check the values entered by the user for ints, floats etc and compare it to their range/limit ? Or is it just over doing the error handling bit.