I am trying to compile this piece of code, but for some reason it will not work. Can anybody help me? I want to know how to use strlen () correctly:
#include<iostream> using namespace std; int main() { char buffer[80]; cout << "Enter a string:"; cin >> buffer; cout << strlen(buffer); return 0; }
I tried using cin.getline (buffer, 80); but I get the same compilation error error.
My compiler says this is a bug
error: strlen has not been declared in this area
c ++
Person
source share