Ok so i've been messing around with this program for many hours and I still dont know how to make it work.
The program is meant to count the words in the string, "Which I will change to make it so it counts the words the user inputs." I thought I was on the right track and hopefully I was.
If you can help me out I will be greatly thankful.
Here is what I have so far.
Code:
#include<stdio.h>
#include<string.h>
void main()
{
char string1[20]="Count words please";
int x=0,y=strlen(string1),z=0;
printf("String Length is %d\n\n",y);
for(string1[x];x<y;x++)
{
if(string1[x]==NULL)
{
z ++;
}
printf("%c",string1[x]);
}
printf("\n\nThere are %d word(s)",z);
scanf("%*c");
}
And once again thanks for the help!!!!!!!
As you can tell im a beginner