Displaying Source Code(s)
|
|
Program to find out if entered string contains a space
character.
--------------------------------------------------------------------------------
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
space(char s);
void main()
{
char s;
clrscr();
printf("Enter string.");
printf("
String will be terminated if you press Ctrl-Z.");
printf("
STRING:- ");
space(s);
printf("
HAVE 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);
}
|
|
|