Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int strlen(char *);
- int main(void) {
- char *string = "A Piece of String";
- printf("%d", strlen(string));
- return 0;
- }
- int strlen(char *s) {
- int length = 0;
- int bool = 1;
- int count = 0;
- while(bool == 1) {
- if(s[count] != '\0') {
- length++;
- } else {
- bool = 0;
- }
- count++;
- }
- return length;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement