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