You do not really have an exact moment that you should use size_t. Because it is the same as 'unsigned int' you use it anywhere you would use an 'unsigned int', the only difference is that an 'unsigned int' is more appropriate for sizes, since it is an unsigned, all its values that would be negative go to the space of the positive values which is better since practically one does not measure size in bytes with negative values. And the advantage of using int type is that sizes in bytes are measured in integer numbers, not decimals, so it would be pointless to use float or double.
The size_t was made more specifically to be used as a result of the sizeof operator, but it is also generally used for indexing arrays and counter loops (for, while) operations that do not usually use negative or decimal values. / p>
So basically, the advantage of using size_t is the same as using 'unsigned int' in the appropriate place, but for the sake of organization, size_t is more used to represent sizes, after all, it would not make sense to use it for other purposes if we can use 'uint32_t' which represents the same thing.