What is size_t data type in C and why is this important?
size_t data type is of equal importance just like any other data type. size_t represents size of an object. For example, if a function needs as parameter the size of integer or character then that size should be stored in size_t data type. In short, the return value of sizeof() should be stored in a variable of type size_t.
Now the question is, Is unsigned int and size_t the same? Are they interchangeable?
No, the code below explains why.
[code language="C"] unsigned int size1  = sizeof(int); //this is valid size_t size2 = sizeof(int); //this is also valid unsigned int size3 = sizeof(char); //ERROR, this is obviously wrong size_t size4 = sizeof(char); //this is valid [/code]
So, you got the difference now? size_t can hold size of any type of any data type. unsigned int can hold size of integer only. We should not have had this doubt at the first place.
This knowledge will help us in understanding about creating linked list which can hold any data type.