can someone explain why I get this error when I compile the source using the following g ++ compiler.
#include <cstdio> #include <string> using namespace std; int main() { char source_language[50]; scanf("%16s\n",source_language); int length = sizeof(source_language); int sizeofchar = strlen(source_language); printf("%d\n",sizeofchar); }
it gives me the following error
test.cpp: In the function 'int main ():
test.cpp: 31: error: 'strlen was not declared in this area
when I change #include <string> to #include <string.h> or #include<cstring> it works fine, I need to find out what the difference is using #include<string> and #include<string.h> . really appreciate any help
Kitis source share