I must to write i program in C which will carry into clause(sentence) from keyboard and count how much "," have how much spaces " " have and how much times occur the word "The" for every clause(sentence). And in the end program when you carry into clause(sentence) must print all inputs particular for every clause how and the same clauses also? I must use array.

EX:
the problem is, my and, is big
In this sentence you have 6 spaces 2 full stops and word "The" is occure 1

I write some code but is not full i need someone to help me to finish the code on this program

#include<stdio.h>
#include<string.h>
#define MAX 100
int main()
{
char sentence[100];
int spaces=0,full_stop=0;
puts("Enter sentence");
gets(sentence);
for(i=0;sentence[i]!='\0';i++)
{	
	if (sentence[i]==',')
full_stop+=1;
if (sentence[i]==' ')
spaces+=1;
}
printf(" %d %d %d  %d pati\n",full_stop,spaces);
return 0;
}

Do the program one step at a time and soon you will have it done. Looks like you have the first two requirements written -- counting the commas and spaces. Next you will probably want to count the number of "the" words. After line 16 add another loop using strtok() to extract the words.

strtok() I dont have learn about this funktion and i dont know how to use it can you give me some code for my program to see how to finished because i realy dont have any idea ?
thanks

>>strtok() I dont have learn about this funktion and i dont know how to use it
Did you think to search google for it? There are hundreds of example to follow, such as this one.

>>i realy dont have any idea ?
Get the above working first and worry about the rest after that. Do a little at a time and you will not get so overwhelmed.

Try using strstr() to search for the. Keep in mind that The and the are not the same because of the first letter.

Here I write some code for my task but it doesent work.
Please someone to chack my code and to correcte my code

#include <stdio.h>
#include<string.h>
int main()
{
	char c[100][100],az='a';
	int n=0,t=0,t1=-1,k1=0,k2=0;
	int i1[1000],u1=0;
	int zap[1000],pra_m[1000],sog[1000],the[1000];
	printf("Enter how much sentence do you wont\n n=");
	scanf("%d",&n);
	printf("Enter the sentence who will be separate vith full stop.\n");
	int i=0,ii=0,iii=0;
	for(k1=0;k1<1000;k1++)
	{
		i1[k1]=-1;ako[k1]=0;zap[k1]=0;pra_m[k1]=0;sog[k1]=0;
	}
	while((t!=n)&&(t1!=n))
	{
		scanf("%c",&c[i][u1]);
		if(c[i][u1]=='\n')
			{
			t1++;u1++;i=0;iii=0;
			}
		i++;i1[u1]++;
		if(iii==0)
			i=0;
			iii++;
		if(ii==0)
			{
				u1=0;
				i=0;
			}
		}
	for(k1=0;k1<n;k1++)
		for(k2=0;k2<=i1[k1];k2++)
			{
				if(c[k2][k1]==',')
					{
						zap[k1]++;
					}
				if(c[k2][k1]==' ')
					{
						pra_m[k1]++;
					}
				if(c[k2][k1]=='t')
					if(c[k2][k1]=='h')
						if(c[k2][k1]=='e')
							the[k1]++;
				for(az='a';az<='z';az++)
				{
					if(c[k2][k1]==az)
					if(c[k2][k1]!='a'&&c[k2][k1]!='e'&&c[k2][k1]!='i'&&c[k2][k1]!='o'&&c[k2][k1]!='u')
						sog[k1]++;
				}
			}
	printf("\n\n");
	for(k1=0;k1<n;k1++)
	{
		printf("zapirki-> %d\n",zap[k1]);
		printf("prazni mesta-> %d\n",pra_m[k1]);
		printf("The-> %d\n",the[k1]);
		printf("soglaski -> %d\n",sog[k1]);
	}
return 0;
}

Here I write some code for my task but it doesent work.
Please someone to chack my code and to correcte my code

No, you check your code. You tell us what it's doing wrong, and what you expected to happen instead. Also, point out where in the code you think the problem is. Then we will point out ways for you to correct the code.

This article has been dead for over six months. Start a new discussion instead.