C++ program to calculate the length of the string using a pointer and functions

 


#include<iostream>

using namespace std;


void string_length()

{

char str[100],*p;

int i=0;

cout<<"Enter Strings Below 100:"<<endl;

cin>>str;

p=str;

while(*p !='\0')

{

    i++;

p++;

}

cout<<"Length Of String Is:"<<i<<endl;

}


int main()

{

    string_length();

return 0;


}

No comments:

Post a Comment

Internet Celebrity Shaam Idrees & his wife Sehar aka Froggy decided to live separately

Famous YouTuber Sham Idris and his wife Sahar aka Froggy have decided to live separately for some time. Sham Idris informed his fans on soci...