|
Get 9,000+ Interview Questions with Answers in an eBook
C Source Codes List | Source Code Home
Program : Program to find out if entered string contains a space character.
/* Prg. to find out if entered string contains a space character */
#include
#include
#include
space(char s);
void main()
{
char s;
clrscr();
printf("Enter string.");
printf("\nString will be terminated if you press Ctrl-Z.");
printf("\nSTRING:- ");
space(s);
printf("\n\n\n\n\n\t\t\tHAVE A NICE DAY! BYE.");
getch();
}
space(char s)
{
int i;
s=getchar();
for (i=0;(s=getchar())!=EOF;i++)
{
if (s==' ')
{
printf("String contains a space character.");
break;
}
}
if (s==EOF)
printf("String does not contain a space character.");
return(s);
}
C Source Codes List | Source Code Home
|
|
|