+ 1
What is the output of this c++ code which has strcat and strspn function?
I have this code. the output of compiler were 11 but I didn't undrestand why? #include <iostream> #include<string.h> using namespace std; int main() { char s1[]="abcdefgh"; char s2[]="ijkl"; strcpy(s2,s1); strcat(s2,s1); cout<<strspn(s1,s2); return 0; }
4 Réponses
+ 1
note one thing strcpy() can copy address not content.
0
compiler ptoduce 11. when length of destination of strcpy is less than source string,what happened?