Learn Computer Science programming - C# and C++ Algorithms

 
String Length (strlen) Implementation

String Length implementation. Returns an integer the length of the string.
Code
stringlength.zip
File Size: 4202 kb
File Type: zip
Download File

#include <iostream>
#include <string.h>
#include <windows.h>
using namespace std;

int StringLength (char s[])
{
char *p=s;
for (*p; *p != '%%CONTENT%%'; p++);
return p-s;
}

void main()
{
int x;
wcout <<  endl << "*** Determine String Length ***" << endl;
wcout << "*************************************************" << endl;
char *d = "Hello World!";
int h = StringLength (d); 
cout << "Size of the string is: " << h <<endl;
cin >> x;
 }