How do you think strlen works?
Here it is, in FV-style indentation: [m]int my_strlen(char *s){char *p; for(p=s; *p; p++); return p-s;}/m]
Doing it for any other types would be as trivial.
If you're using a linked list, something like: for(size=0;*p;p = p->next,size++); would do the job of calculating the total size/length.