Why does the self-written strlen () function have a warning without adding < string.h >?

related codes

// 
-sharpinclude <stdio.h>
-sharpdefine N 100
int strlen( char string[])
{
    int i=0;
    while(string[i]!="\0") iPP;
    return i;
}
int main()
{
    char string[N];
    scanf("%s",string);
    int r=strlen(string);
    printf("%d\n",r);
    return 0;
}

what result do you expect? What is the error message actually seen?

for example, this program does not add a header file < string.h >. It does pop up a warning when compiling: [Warning] conflicting types for built-in function "strlen"
but there is no warning if you change the function name strlen to mystrlen. Why?

C
Apr.12,2021

clipboard.png

GCC means there is no such problem

guess that your IDE is the problem. I don't know what IDE, is supposed to be the option of enabling default library files

.

title code format is difficult to enter

Menu