Error One
Keywords: indirect addressing levels are different
#define_crt_secure_no_warnings#include<stdio.h>#include<stdlib.h>#include<string.h>CharStrcatChar*a,Char*b) {Charc[199]; intN,i; intStrlena,strlenb; Strlena= (int) strlen (a); Strlenb= (int) strlen (b); N=strlena+Strlenb; for(i=0; i<strlena-1; i++) c[i]=A[i]; for(i=strlena-1; i<n;i++) c[i]=b[i-Strlena]; returnc[199]; } intMainvoid) { Chara[ -]; Charb[ -]; scanf ("%s",&a); scanf ("%s",&b); printf ("%s", strcat (A, b)); System ("PAUSE"); return 0; }
View Code
What: Error C2040: "strcat": "Char (char *, char *)" and "char * (char *, const char *)" with different levels of indirection
Cause: Variable or method repeating definition
Specific solution: In this example strcat () method programmer custom One, string.h also defined A, C language does not exist overload, so detected two the same function name error.
C Language Bug Error collation