Comments

Wednesday, October 17, 2012

Find length of string without using strlen().

Posted by at 8:44 AM Read our previous post


Object
1-      Find length of string without using strlen().


Source code

#include <iostream>
using namespace std;
void main()
{
       int str;
       char Array[75];
       cout<<"input info in alphabets"<<endl;
cin>>Array;
       for(str=0;str<75;str++)
       {
             
              If (Array[str]=='\0')
             


{


cout<<str;

//array count from 0 and goes to ‘\0’ it’s also count ‘\0’ and give the no of box of ‘\0’ which is our length.
             

Break;
             
}
       }
             
}


Output

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Popular Posts

Labels

© Codepirate is powered by Blogger - Template designed by Stramaxon - Best SEO Template