Hello
I have this code
It works but i dont how. I mean string[0] != '\0' will be always true if the string is > 0 and it is. How can len be the lenght if p points to the begining of string? I suppose p points wherever string does, right?Code:int mystrlen(char *string) { int len; char *p = string; for(; string[0] != '\0'; string++) ; len = p - &string[0]; return len; }
I was wondering how can i write this function without pointer p..
Thanks