C Codes
Beginners
C on Unix
Code Snippets
Data Structures
File Operations
Games Graphics
Gnu-Linux
Hardware
Mathematics
Miscellaneous
Small Programs
Sorting
C > Beginners Lab Assignments sample source codes
Program to find out if entered string contains a space character
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); }
Privacy Policy
|
Link to Us
|
Links