C++ program to find the length of a given string
kw.cpp
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    cout<<strlen("Kodingwindow")<<"\n";
}
Output
kodingwindow@kw:~$ g++ kw.cpp
kodingwindow@kw:~$ ./a.out 12 kodingwindow@kw:~$
C++ program to find the length of a given string
kw.cpp
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    cout<<strlen("Kodingwindow\0")<<"\n";
}
Output
kodingwindow@kw:~$ g++ kw.cpp
kodingwindow@kw:~$ ./a.out 12 kodingwindow@kw:~$
Advertisement