Posts
 
Reputation
Joined
Last Seen
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
0% Quality Score
Upvotes Received
0
Posts with Upvotes
0
Upvoting Members
0
Downvotes Received
3
Posts with Downvotes
2
Downvoting Members
2
2 Commented Posts
0 Endorsements
Ranked #72.7K
~665 People Reached
Favorite Forums
Favorite Tags
c x 2
Member Avatar for kn_jee

[CODE]#include<stdio.h> #include<string.h> int count(char string[]); void main(){ int i; char string[1001]; printf("String: \n"); gets(string); i = words(string); printf("No. of Words %d", i); } int count(char string[]) { int i, j, k; for(i = 0; i < strlen(string); i++){ if(string[i] == ' ') k += 1; else j += 1; } …

Member Avatar for md_azaz1
0
399
Member Avatar for sgriffiths

Hello I would like to count how many words are in a string ie "PETER JOHNSON LTD" so this string contains 3 I was going to use strtok but this is too slow. Any other ideas?

Member Avatar for jephthah
0
266