Displaying Source Code(s)
|
|
Program to display the length of the entered string. (like
strlen function)
--------------------------------------------------------------------------------
#include <stdio.h>
#include <conio.h>
void main()
{
int i,l=0;
char c;
clrscr();
printf("Please enter a string.");
printf("
String will be terminated if you press Ctrl-Z.");
printf("
STRING:- ");
for (i=0;(c=getchar())!=EOF;i++)
l=l+1;
printf("Length of the entered string is %d",l);
getch();
}
|
|
|