C program to print length of string
         C program to print length of string
Output:-
Note:- Compiler will also count blank spaces between words while compiling.
include<stdio.h>
void main(){
char str[15];
int=0;
printf("Enter any string :\t"); 
 scanf("%s",&str);
while(str[i]!='\0')
{
i++;
printf("\nLength of string :\t%d",i);
getch();
} 
Output:-
Enter any string :      ankit c guru 
Length of string : 12
Length of string : 12
Note:- Compiler will also count blank spaces between words while compiling.
Comments
Post a Comment