If I have a const char * of "bad,cold,new" how can I count just the number of commas? Do I need to convert it to string? If so, how do I do that? Do I need to convert all the commas to zeros first? How do i do that?
balla4eva33
0
Junior Poster in Training
Recommended Answers
Jump to Postjust declare another pointer to be the same as the original and increment it until it reaches the end of the string. Along the way count the number of commas etc. You could use the original pointer but its better not to so that you don't destroy the address of …
All 4 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
balla4eva33
0
Junior Poster in Training
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
balla4eva33
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.