// str_len.c.c
#include <stdio.h>
size_t strlen(char*);
int main(void)
{
char* name = "ThisIsAStringLiteral";
printf("%u\n", strlen(name));
return 0;
}
size_t strlen(char *str){
auto unsigned long n=0;
while (*str++) n++;
return ++n; // for '\0'
}
No comments:
Post a Comment