unsigned int num_items(const char* str, char delimiter){ unsigned int words=0; if(!str) return 0; while(*str){ words += (*str++) == delimiter; } return words+1; }