I think what you're looking for is
signed char i = -1;
unsigned char j = i;
printf("%u\n", j);
In 8 bits, the signed number -1 "wraps around" to the unsigned value 255.
You asked about size_t because, yes, it's an unsigned type, but it's typically 32 or even 64 bits. At those sizes, the number 255 is representable (and has the same representation) in both the signed and unsigned variants, so there isn't a negative number that corresponds to 255. But you can certainly see similar effects, using different values. For example, on a machine with 32-bit ints, this code:
unsigned int i = 4294967041;
int j = i;
printf("%d\n", j);
is likely to print -255. This value comes about because 2^32 - 255 = 4294967041.
nto 255. :-Pnto255. The simplicity and triviality of the answer makes one suspect that you missed something in your question.n? Anyway, it is not possible to answer the question about negative value ofnwithout knowing the exact characteristics ofsize_ttype (its range, specifically). It is platform-dependent. And you should use%zuto printsize_tvalues, not%lu.-1to anuint8_t, you'll get255. However,255is less than0x8000, so I don't think you'll be able to get it by casting a negative to any integer type larger than 8 bits. And needless to say, I don't think you're going to find any modern platforms (or ancient ones, for that matter) on whichunsigned longis only 8 bits in size.