How do you write a program to find the length of a string?

1 answer

Answer

1161097

2026-07-25 10:16

+ Follow

/* with run-time library */

int len;

char* str;

len = strlen (str);

/* without run-time library */

int mystrlen (const char* str) {

int len;

while (*str != '\0') {

len++;

str++;

}

return len;

}

int len;

char* str;

len = mystrlen(str);

ReportLike(0)ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.