Program to find the length of a string without using library function

Tuesday, August 11, 2020

C++ is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation. C++ is one of the most popular programming languages. It is based on C but is an object-oriented programming language. It is widely used in graphics libraries, games, network devices, etc.

//Program to find the length of a string without using library function

#include<iostream.h>

#include<conio.h>

#include<stdio.h>

 void main()

 {clrscr();

 char str[30];

 int len;

 cout<<"\n Enter a String :";

 gets(str);

 for(len=0;str(len)!='\0';++len);

 cout<<"\n The Length of The String="<<len;

 getch();

 }

You Might Also Like

0 Comments

Like us on Facebook

Flickr Images

Flickr Short Films